Computing: DOS, OS/2 & Windows Programming

Installing PHP on Windows XP and using it with IIS.

This tutorial is about installing PHP 5 on Windows XP (32-bit) and using it with IIS, i.e. running PHP scripts on an IIS web server. It is supposed that you have IIS 5.1 installed . If not, or just in order to have a look at the actual website configuration on my Windows XP virtual machine, you might want to read my tutorial Installing Internet Information Server (IIS) on Windows XP. In fact, this tutorial may be seen as a sequel of the IIS tutorial.

I'm not sure if it is mandatory to install IIS Manager 6.0, but it can't be wrong to upgrade a piece of software if this is possible, and my PHP system installed fine with IIS Manager 6.0 installed and used to configure the web server for PHP. I suppose that at the times of Windows XP, IIS Manager 6.0 could be downloaded from Microsoft. Nowadays, it's more difficult to find a copy of the software. I downloaded it from cnet.com; here is the link to their IIS Manager 6.0 page.

The download file is a Windows installer. Setup should succeed without any issues.

PHP on Windows XP: Installation of IIS Manager 6.0

After setup is finished, you will find two IIS shortcuts in Control Panel > Administrative Tools. You can forget the old one, and you can copy the new (IIS 6) one onto your desktop.

If you have configured IIS as I describe in my Installing Internet Information Server (IIS) on Windows XP tutorial, no further configuration is needed for the moment. The screenshots below show the Web Site tab (screenshot on the left) and the Home Directory tab (screenshot on the right) of the Properties window for my web server in IIS 6 Manager. The local network configuration being as described in my IIS tutorial, and index.html having been created and set as default document, the website on wk-winxpe should be accessible by entering http://wk-winxpe in the web browser's address field (and with FTP configured as described in the IIS tutorial, the FTP site should be accessible by entering ftp://wk-winxpe). On your system, you would probably use localhost instead or 127.0.0.1 instead of wk-winxpe.

PHP on Windows XP: Web server 'Web Site' properties viewed in IIS Manager 6.0
PHP on Windows XP: Web server 'Home Directory' properties viewed in IIS Manager 6.0

Running PHP on Windows XP means using PHP 5. I actually use PHP 5.2.3 that I downloaded from atksolutions.com; here is the PHP installation files direct download link. This is probably not the most recent version of PHP 5 that works on Windows XP. If you really want the latest version, you might try PHP 5.3 or 5.4 (search Google to find the installation files). Normally there shouldn't be a need to do so, and the point is: You can be sure that version 5.2.3 does work...

The PHP download file is a ZIP archive containing the folder structure. Create the directory C:\php and unpack the archive content to there (if you haven't an application to open ZIP files installed, search the Internet for "7-Zip for Windows XP"). The screenshot shows the files and folders in C:\pbp.

PHP on Windows XP: PHP installation directory

It's really easy to configure IIS for PHP. In IIS Manager 6.0, right click your web server, and from the opening context menu choose Properties. In the Properties window, open the Home Directory tab. The lower part of this tab contains the IIS Application settings. Push the Configuration... button to set up PHP.

On the Mappings tab of the opening Application Configuration window, check if the extension .php is listed. It's probably not, thus push the Add button to add it (screenshot on the left). In the Add/Edit Application Extension Mapping window, add the extension .php and use the Browse button to add the C:\php\php5isapi.dll executable (you have to add the DLL, not php.exe!) (screenshot on the right).

PHP on Windows XP: Configuring IIS for PHP (using the php5isapi DLL) [1]
PHP on Windows XP: Configuring IIS for PHP (using the php5isapi DLL) [2]

Note: Enabling all verbs is ok on a local test server. In the "real world", you would have to be more restrictive...

When pushing the OK button in the Application Configuration window, another window shows up, asking you if the child node "Printers" should use the new value of the "ScriptsMaps" property. I got similar configuration questions when setting up IIS. No idea, what this is about. I choose to use the new value for "Printers" (?).

Two steps left to configure IIS for PHP.

To test our PHP installation, lets create a simple PHP script info.php and place it into the web server's root directory (D:\inetpub\wwwroot on my system). Here is the file content:
    <?PHP
        phpinfo();
    ?>

The screenshot shows the IIS root directory with the file info.php opened in my text editor.

PHP on Windows XP: Simple script to test the PHP installation

I ran the script by entering http://wk-winxpe/info.php in the address field of my Maxthon web browser (on your system, you would probably enter localhost/info.php). The screenshot shows the output of the script.

PHP on Windows XP: PHP script - Display of phpinfo in Maxthon web browser

If you like this page, please, support me and this website by signing my guestbook.