Install PHP 5 on IIS 6
Tagged:

OS: Windows Server 2003

1. Download the PHP 5 installer.
Download the latest PHP version for Windows from http://www.php.net/downloads.php

Note: I'm downloading the windows installer package (php-5.2.9-2 installer).

2. Install PHP.
I have included all the installation steps along with the images to avoid confusion.

Double Click the installer.

Click "Run".

Click "Next".

Check on "I accept the terms in the License Agreement" and Click "Next".

Choose the Destination folder and Click "Next".

In the next "Web Server Setup" stage, select "Do not setup a web server" and click "Next".
(Note: I'm installing PHP 5 on Windows Server 2003 where IIS 6 has already been installed, hence I've selected this option)

Next we need to "Choose the Items to Install". Here, we need to customize our PHP installation by selecting the features and extensions that we need. For the time being, I'm installing the Entire feature to avoid the hassles of copying the extra required extensions in the future.
Then, Click "Next".



Click "Finish" after the installation is over.

3. Configure Internet Information Services (IIS) Manager.

Launch the "Internet Information Services (IIS) Manager" from the start menu.

Right-click on "Website" and select "Properties".

Select the "Home Directory" tab and choose "Configuration".

Click the "Add" button.

On the next screen, browse for the file "php5isapi.dll" in the php installation directory and add its path on the "Executable:" field. In my case, the path is "C:\Program Files\PHP\php5isapi.dll".
Note: In this path, you should include the quotes too. You should also make sure that you have installed PHP to include the file "php5isapi.dll". If you have customized your installation and this file is not present, you should copy it manually.

Then, add .php in the 'Extension' field. In the 'Verbs' field, check on "All verbs". Leave the rest to default and Click OK.

Now, choose the "Documents" tab and select "Add".

Enter index.php and click OK.

You can even change the priority of your index.php with the "Move Up" button to allow index.php to run as a directory default. Here, you can enable the priority of default content page as required.

Finally, right click on "Web Service Extensions" on the left side and choose "Add a new Web service extension".

Now, Enter 'PHP ISAPI' on the "Extension Name:" field and Click on "Add" and browse to a path for 'php5isapi.dll' file. In my case, it's "C:\Program Files\PHP\php5isapi.dll".
Then, Check 'Set extension status to Allowed' and Click OK.

Again, right click on "Web Service Extensions" on the left side and choose "Add a new Web service extension" as earlier. Then, Enter 'PHP' on the "Extension Name:" field in this case and Click on "Add" and browse to a path for 'php.exe' file.In my case, it's "C:\Program Files\PHP\php.exe".
Then, Check 'Set extension status to Allowed' and Click OK.

The completed "Web Service Extensions" window should now look like the figure below. IIS now knows to process PHP files and our "Web Service Extensions" can run PHP scripts freely. Note 'PHP' and 'PHP ISAPI' on the list below and make sure their status has been set to Allowed.

Finally, Restart the IIS.

4. Testing PHP support on IIS.

Create a php file 'phpinfo.php' and save it under C:\Inetpub\wwwroot\phpinfo.php.

The file should contain the lines below:

Now, open this file on your browser ( Go to http://localhost/phpinfo.php).
You should be presented with the PHP info page as below if your PHP5 installation was successful.