Installing PHP 3.x.x for IIS 4.x on Windows NT
by Nathan Wallace
(Oct 19, 1999)
These instructions assume that you have a standard IIS 4 installation on Windows NT. Thanks go to Ted and Randy for their help compiling these instructions.
- 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 IIS to use PHP
- In Internet Service Manager (MMC), select the Web site or the starting point directory of an application.
- Open the directory's property sheets (by right clicking and selecting properties), and then click the Home Directory, Virtual Directory, or Directory tab.
- Click the Configuration button, and then click the App Mappings tab.
- Click Add, and in the Executable box, type:
c:\php\php.exe %s %s
You MUST have the %s %s on the end, PHP will not function properly if you fail to do this.
- In the Extension box, type the file name extension you want associated with PHP scripts. (You must repeat step 5 and 6 for each extension you want accociated with PHP scripts. (.php3 and .phtml are common choices)
- Set up the appropriate security. (This is done in Internet Service Manager), and if your NT Server uses NTFS file system, add execute rights for I_USR_ to the directory that contains php.exe.
Checking it works
- Restart your IIS server if you haven't already done so.
- Let's create a test PHP file (test.php3) in the root directory of the web server. This file should contain a single line like this:
<?php phpinfo() ?>
- Point your browser at http://localhost/test.php3 (or equivalent on your machine). If you get an error then you have done something wrong. Otherwise, you should see a page that looks something like this (link removed).