Installing PHP 3.x.x for Apache 1.x.x on Windows 9x
by Nathan Wallace
(Sep 30, 1999)
These instructions assume that you installed Apache for Windows 9x as outlined here
. They should work with any standard Apache installation.
- Make a directory, c:\php.
- Download the PHP distribution from your nearest mirror. Here's a direct link to php-3.0.11-win32.zip.
- Save the PHP zip file into the directory c:\php
- Open Windows Explorer from your Start Menu.
- Go to the c:\php folder.
- Double click on the php zip file, php-3.0.11-win32.zip or equivalent. Hopefully you have winzip installed and this will work. Otherwise, you need to get winzip from somewhere.
- Extract the files out into the c:\php directory.
- Copy the distribution PHP3 ini file into the c:\windows directory as php3.ini. Here are the commands in a DOS box. If you installed windows into some non-standard directory like c:\win98, then you must use that directory instead. Make sure that you rename the ini file!!!
copy php3.ini-dist c:\windows\php3.ini
- Now we have to edit the PHP ini file. First we must tell PHP where it can find the dll's for the extensions. On line 100:
ExtensionDir = "c:\php"
- If you plan to use MySQL (or some other modules) then you must enable those extensions. You can do this by uncommenting the relevant lines. For MySQL it should be on line 115:
You may also need to set some of the MySQL parameters in the ini file.
Configuring Apache to use PHP
- We need to make a number of changes in the httpd.conf file. This file is located at:
c:\Program Files\Apache Group\Apache\conf\httpd.conf
First we must add a script alias for PHP around line 459:
ScriptAlias /php/ "c:/php/"
We need to make Apache aware of the PHP file types. These can be any extensions that you wish to use, I've chosen php3, phtml and phps for PHP source. Add these around line 594:
AddType application/x-httpd-php3 .phtml
AddType application/x-httpd-php3 .php3
AddType application/x-httpd-php3-source .phps
Now we need to tell Apache to use the PHP parser to handle php types. Add an Action directive near line 641:
Action application/x-httpd-php3 "/php/php.exe"
- You will need to restart the Apache server for these changes to take effect.
Checking it works
- Restart your Apache server if you haven't already done so.
- You can check that Apache is still working by just opening a browser and going to the URL http://localhost. If you see a page that says "It Worked!" (or whatever page you normally see if you've already been using Apache), then obviously Apache is still working.
- Let's create a test PHP file in:
c:\Program Files\Apache Group\Apache\htdocs\test.php3
- This file should contain a single line like this:
<?php phpinfo() ?>
- Point your browser at http://localhost/test.php3. If you get an error then you have done something wrong. Otherwise you should see a page that looks something like this (link removed).