JavaScript Editor Javascript source editor     Web programming 



Team LiB
Previous Section Next Section

Installing PHP on Windows

Installing PHP on Windows requires nothing more than downloading the distribution and moving a few files around. To download the PHP distribution files, go to the home of PHP, http://www.php.net/, and follow the link to the Downloads section. Grab the latest version of the zip package (not the installer!) from the Windows Binaries sectionfor this example, we are using 5.0.2. Your distribution will be named something to php-version.zip, where version is the most recent release number.

Once the file is downloaded to your system, double-click on it to launch your unzipping software. The distribution is packed up with relative pathnames already in place, so extract the files to the a new directory called C:\php5\ where it will place all the files and subdirectories under that new directory.

Now that you have all the basic PHP distribution files, you just need to move a few of them around:

1.
In the PHP installation directory, find the php.ini-recommended file and rename it php.ini.

2.
Copy the php.ini file to C:\WINNT\.

3.
Copy the php5ts.dll file to C:\WINNT\SYSTEM\.

To get a basic version of PHP working with Apache, you'll need to make a few minor modifications to the Apache configuration file.

Integrating PHP with Apache on Windows

To ensure that PHP and Apache get along with one another, you need to add a few items to the httpd.conf configuration file. First, find a section that looks like this:

# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule access_module modules/mod_access.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_module modules/mod_auth.so
#LoadModule auth_anon_module modules/mod_auth_anon.so
#LoadModule auth_dbm_module modules/mod_auth_dbm.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule cgi_module modules/mod_cgi.so
#LoadModule dav_module modules/mod_dav.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
#LoadModule expires_module modules/mod_expires.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule headers_module modules/mod_headers.so

At the end of this section, add the following:

LoadModule php5_module c:/php5/php5apache2.dll

Next, look for this section:

#
# AddType allows you to add to or override the MIME configuration
# file mime.types for specific file types.
#

Add the following lines:

AddType application/x-httpd-php .php .phtml .html

This ensures that the PHP engine will parse files that end with the .php, .phtml, and .html extensions. Your selection of filenames might differ, and you might want to add .php3 as an extension, for backward compatibility with any very old scripts you might have.

Save this file, and then restart Apache. The server should start without warning; PHP is now part of the Apache Web server.

    Team LiB
    Previous Section Next Section


    JavaScript Editor Javascript source editor     Web programming