Installing PHP 3.x.x for IIS 4.x on Windows NT

by Nathan Wallace (Oct 19, 1999)

Introduction

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.

Getting PHP

  1. Make a directory, c:\php.

  2. Download the PHP distribution from your nearest mirror. Here's a direct link to php-3.0.11-win32.zip.

  3. Save the PHP zip file into the directory c:\php

Installing PHP

  1. Open Windows Explorer from your Start Menu.

  2. Go to the c:\php folder.

  3. 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.

  4. Extract the files out into the c:\php directory.

Configuring PHP

  1. 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!!!
        cd c:\php
        copy php3.ini-dist c:\windows\php3.ini
    

  2. 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"
    

  3. 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:
        extension=php3_mysql.dll
    
    You may also need to set some of the MySQL parameters in the ini file.

Configuring IIS to use PHP

  1. In Internet Service Manager (MMC), select the Web site or the starting point directory of an application.

  2. Open the directory's property sheets (by right clicking and selecting properties), and then click the Home Directory, Virtual Directory, or Directory tab.

  3. Click the Configuration button, and then click the App Mappings tab.

  4. 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.

  5. 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)

  6. 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

  1. Restart your IIS server if you haven't already done so.

  2. 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() ?>
    

  3. 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).