Tech Tip: How to install PHP for IIS 6.0 Windows Server 2003

A while back I wrote this tutorial for some friends who wanted to run their own Windows web server. PHP is a popular scripting language that allows the creation of dynamic webpages. PHP is server-side-scripting so the use of PHP is completely transparent to the end-user.

Windows Server does not natively support PHP and you would have to install it manually. If you’re running Windows Server 2003 and would like to setup PHP for it follow the process outlined below:

1. Download the PHP zipped package from

2. Download the Collection of PECL modules zipped file. These contains the various extensions PHP can use.

3. Unzip the PHP zipped package to C:\PHP

4. Unzipped the PECL modules and extract its contents into C:\PHP\ext

5. Inside C:\PHP, rename php.ini-recommended to php.ini

Make sure each line is uncommented by removing the semicolon ;
For example,

;cgi.force_redirect = 0
cgi.force_redirect = 0

1. extension_dir = C:\PHP\ext (This tells your server where your extension modules are located.)

2. cgi.force_redirect = 0 (Changing this value is important as it is required to make PHP work for IIS.)

3. After editing the php.ini file, move the file to the C:\Windows directory. (Windows automatically will look for the php.ini in this directory)

After editing your PHP files you will need to tell the server where the files are located.

1. Right-click on My Computer > Properties > Advanced Tab

2. Click on Environment Variables button

3. Under System variables, scroll down to the Path variable and double-click on it.

4. In Variable Value you will see a string of code, add “;C:\PHP” at the end of the code, minus the quotes.

5. Click on OK on all the windows until they’re all closed.

Next you will configure IIS to handle PHP.

1. Go to Administrative Tools > Internet Information Services (IIS) Manager

2. You will see your local system. Click on it to expand it.

3. Click and access Web Service Extensions

4. You will see a link called, Add a new Web service extension…, click on it.

5. A window will open, and enter the extension name, “PHP ISAPI”

6. Press the Add… button and browse to your C:\PHP directory and open php5isapi.dll

7. Make sure you check mark Set extension status to Allowed, and press OK.

Now that the PHP extensions have been added to IIS, you will now tell your website(s) to use it.

1. In the IIS manager, right-click on the Web Sites directory and select Properties.

2. Go to the Home Directory tab and click on the Configuration button.

3. Make sure you in the Mappings tab and press the Add button.

4. For the Executable, browse to the C:\PHP\php5isapi.dll file

5. For Extension, type in “.php”, leave other options alone and click on OK.

Lastly, you will need to set permissions for the C:\PHP directory. These permissions will allow IIS to access the necessary php files.

1. Right-click on the C:\PHP directory and go to “Sharing and Security…”

2. Select the Security tab and under the Group or user name list make sure the “Users” group has been added.

3. If the Users group is not listed. Press the Add button.

4. Then press the Advanced button to see more options.

5. Then press Find Now… to list the available Groups and Users.

6. Select the “Users” group and press OK back to the Security tab.

7. For permissions, make sure the Read & Execute and Read checkboxes are checked. Read & Execute has a dependent permission.

8. As an option, you can check the Write permission if you plan on have sessions stored in that directory (or sub-directory).

One Reply to “Tech Tip: How to install PHP for IIS 6.0 Windows Server 2003”

Leave a Reply

Your email address will not be published. Required fields are marked *