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,, 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, 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:

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

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

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/
LoadModule access_module modules/
LoadModule actions_module modules/
LoadModule alias_module modules/
LoadModule asis_module modules/
LoadModule auth_module modules/
#LoadModule auth_anon_module modules/
#LoadModule auth_dbm_module modules/
#LoadModule auth_digest_module modules/
LoadModule autoindex_module modules/
#LoadModule cern_meta_module modules/
LoadModule cgi_module modules/
#LoadModule dav_module modules/
#LoadModule dav_fs_module modules/
LoadModule dir_module modules/
LoadModule env_module modules/
#LoadModule expires_module modules/
#LoadModule file_cache_module modules/
#LoadModule headers_module modules/

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