Step-by-Step: How to Configure IIS for PHP
December 28, 2003


This guide assumes that you have already installed PHP on your system.  If you have not yet done so, please take a look at this guide: Installing PHP on a Windows Webserver

Here we'll configure IIS to use PHP.  Hopefully the PHP install program already configured IIS, but sometimes, we have to do this manually and this guide shows you how.

Start -> Settings -> Control Panel -> Administrative Tools -> Internet Information Services.

Click on your server name, then right-click on "Web Sites" and select "Properties".

 

Select the "Home Directory" tab.

 

At "Execute Permissions" change the setting from "None" to "Scripts and Executables".

 

Now click the "Configuration" button.

 

If you see this line, everything is fine.

 

If you don't see it, we'll add it.  Click the "Add" button and fill it out as you see here.

 

Click "OK" to close all the dialog boxes.

Now we have to set the default document to process .php files.

Under website properties, go to the Documents tab.

 

Click "Add".  In this box, list the default document name that you use as your default.  It will probably be something like "index.php" or "default.php".  In this example, we'll use "index.php".

Click "OK".

 

The document will initially be at the bottom of the list.

 

Click on the left "up" arrow to promote the file to the top.

 

Click "OK".

You'll see this message.  It ask whether you want all the child directories to also inherit the changes you made.  Click on the "Select All" button then click "OK".

 

Then you'll see another message that asks if we want to "Default Document" property to be set for the child nodes as well.  Click on "Select All" then click "OK".

 

Now we have to write a small php file to test out if PHP actually works on IIS.

Open up Notepad and paste the code between the two lines in the page.

----------------------------
<html>
 <head>
  <title>PHP Test</title>
 </head>
 <body>
 <?php echo "<p>Hello World</p>"; ?>
 </body>
</html>
----------------------------

In Notepad, select "File" then "Save As".  Browse to your website document directory and save the file as "index.php".  Keep the "" marks.  This makes Notepad save the file with the ".php" extension instead of ".txt".

 

Now fire up your web browser and point it at the directory where you saved the file.  You should see this:

 

If you see the actual code of the page, then something is wrong.  You will need to go back and figure out what is missing.

Depending on your particular setup, you may or may not have to edit a file called php.ini.  This file is in your c:\windows directory.

Now you have PHP setup for IIS!

Brian
 



Installing PHP on a Windows Webserver

Additional Information

Resources: Step-by-Step: