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 simpleblog/ directory and its contents. This sample and all others have at least three directories:
libs A set of PHP include (.inc) files that need to be copied to somewhere in the include_path for PHP
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 simpleblog/ 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:
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).
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.
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.
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 32-1).