Configuring PHP5 to run on IIS6.
(Windows Server 2003)
PHP5 is an "Open Source" scripting language and
provides similar functionality to Microsoft's ASP. Obviously,
both have their advantages and a comparison of the two technologies
is outside the scope of this tutorial. However, a common misconception
is that PHP is "Linux only" and not compatible with
To find out more about PHP, visit http://www.php.net
1. Getting the PHP5 package.
A visit to the www.php.net downloads
page reveals several choices in the "Windows Binaries"
section. Download the zip package (details below):
- PHP 5.0.4 zip package [7,488Kb]
(Please note that later versions may be available as
you read this)
The ZIP package is the preferred
option (when compared with the Installer) simply because
it includes greater functionality and extensions. However,
this should be obvious from the much greater download
2. Extracting the files:
Figure 1 - Extracting the files
Unzip the PHP archive to C:\PHP5 then
copy "php5ts.dll" (highlighted
in Figure 1 above) into C:\Windows\System32\
Next, copy "php.ini-recommended"
to C:\Windows\ and rename it "php.ini"
3. Configuring Internet Information Services (IIS) Manager:
Figure 2 - Accessing the "Web Sites Properties"
dialogue box in IIS
If you are using the new style Start
menu, you can reach the Internet Information Services
console by clicking "Start", "Administrative
Tools" and selecting "Internet Information
Services (IIS) Manager" from the list.
If you are using the "Classic" style Start
Menu, you can reach the console by clicking "Start",
"Programs", "Administrative Tools"
and select "Internet Information Services (IIS)
Manager" from the list.
The first thing we need to do is tell IIS how it should
process PHP files. To do this, first right-click on
"Web Sites" in the left-hand menu and select
"Properties" from the list that appears (as
shown in Figure 2 above).
Figure 3 - Application Configuration
Once open, select the "Home Directory"
tab and click on "Configuration". A similar
window to figure 3 (above) will appear. Click on "Add".
Figure 4 - PHP Application Mappings
Complete the box shown in Figure 4 (above)
as shown then press "OK". If you see a message
appear with a list of "Child Nodes" you should
check them carefully before selecting which should be
PHP-enabled. Be particularly careful if you are running
Microsoft Exchange Outlook Web Access (OWA) as overriding
the OWA Virtual Directory settings will stop it from
IIS now knows how to process PHP files.
However, it's "Web Service Extensions" rules
still restrict it from doing this.
Figure 5 - Web Service Extensions
We now need to configure "Web Service Extensions"
so right-click on "Web Service Extensions"
in the menu on the left. Then select "Add a new
Web service extension..." from the list (as shown
in Figure 5 above)
Figure 6 - Creating a PHP web service extension
Complete the dialogue box as shown in
Figure 6 above. Make sure you check the "Set extension
status to Allowed" checkbox. The "Extension
name:" is only a reference and hence can be anything
- PHP makes it easy to identify in future though.
Figure 7 - The completed Web Service Extensions
The completed "Web Service Extensions"
window should now look like figure 7 above.IIS now knows
to process PHP files and our "Web Service Extensions"
have made it possible for PHP scripts to run freely.
4. Allowing index.php files to run as a directory default:
Figure 8 - Configuring your default PHP content
Returning to "Web Sites Properties"
dialogue shown in Figure 2 we need to select the "Documents"
tab and click on "Add".
To ensure that index.php documents open
as a default they should be added as a "Content
Page" as shown in Figure 8. You can, of course,
change the importance of PHP over ASP and HTML documents
to suit your site based on which document type should
Figure 9 - Results.
Create a new text file and rename it "index.php".
This file should contain one line that reads:
Simply copy this file to your web server
and open it via your favourite web browser. You should
be presented with a page similar to Fig. 9 above.