Документация
HTML CSS PHP PERL другое

Installing and Running the Sample

 
Previous
Table of Contents
Next

Installing and Running the Sample

Before this chapter begins a walkthrough of the code, you need to understand the basics of setting up this sample application. You can find full code on the CD that accompanies this book. The CD is viewable on any Windows, Unix, or Mac OS X computer. Software needed to run your web applications such as PHP, MySQL, and Apache is included on the disc.

In the booksrc/ directory are a number of subdirectories, including chapters/, appointments/, ecommerce/, and simpleblog/. For this chapter, we will concern ourselves with the ecommerce/ directory and its contents. This sample has four subdirectories that we will use:

  • libs A set of PHP include (.inc) files that will need to be copied to somewhere in the include_path for PHP.

  • content A directory containing image files that will be used to show the user which products we have for sale. Instead of storing whole image files in our database (a task for which most database servers are not optimally suited), we will store links to these files.

  • setup A script or set of scripts for ensuring that the database is properly set up to run this application.

  • webapp A directory containing the actual scripts, pages, and other files (such as CSS) that will be run directly by the client to operate the web application.

In the ecommerce/ directory is a file called INSTALL.TXT, which walks you through all the steps necessary to get the sample running.

These steps are broken down into three major actions:

1.
Make sure that PHP and php.ini are properly configured for the application. For this sample, this basically just requires making sure that the mysqli extension is compiled into PHP (Unix) or enabled (Windows).

2.
Set up the database and tables with which the application will work. A script is provided that you can run in your database server to create the database, tables, and user accounts that our application will run.

3.
Copy the files that make up the application into the appropriate places. In addition to the core .php files via which the application runs, there are some .inc files with extra functionality that we will put in a secure location in the include path on our system. The content image files will be placed in an appropriate directory.

After you have all of this configured, you should be able to bring up the home page for the application by typing in the appropriate URL for the provided index.php (see Figure 33-1).


Previous
Table of Contents
Next
© 2000- NIV