How to Install PHP on a Microsoft IIS 5 Server
If you need to run PHP on a Microsoft IIS server, you’re in luck! While not the easiest installation in the world, this article should walk you through the difficult parts and have you up an running in a few minutes.
The first thing you’ll need to do is download PHP for Windows. You can do this online at http://www.php.org. For this installation, make sure you get the most recent version of the installer, then we can go to the installation section.
On the server, double click the installer icon and follow the instructions. It will try to place files in a directory located at “c:php”.
Open the file named PHP.INI-DIST from your c:php directory and find the line which contains with:
cgi.force_redirect = 1
Delete this line and add the following line:
cgi.force_redirect = 0
Every action on a Windows IIS server is regulated by the Windows permissions system, PHP is no different. In order for people to execute PHP code you must first tell Windows that the anonymous internet user (IUSER) is permitted to execute code in the PHP directory (c:php).
You do this by right clicking on the file folder and opening the properties dialog box and switching to the Security tab. Make sure that your anonymous internet user (IUSER) has full permissions for this directory. If it does not, add the IUSER to your list and click “Full Control”.
This will allow PHP files on the web server to access the PHP.EXE file.
Create a new document using NotePad or your preferred text editor assigning the extension “.php” to the filename of your choice. For my example, I will create a new file named “test.php” in the directory “c:inetpubwwwroottest” (my IIS server is on the same machine as I am typing, your path may be slightly different).
Once created, I will place the text <?php echo “Hello World<p>”;?> in my test.php file, exactly as shown.
What does the text mean? Let’s take a quick look at PHP structure.
<?php
The first part of this code tells the document that there is PHP coming and to interpret it.echo “Hello World<p>”;
The second part asks the PHP interpreter to echo (print) the phrase Hello World to the screen.?>
This last part of the tag tells the server that our PHP is done, and not to interpret the remained of the document as PHP unless a PHP tag is encountered.
Now that you’ve saved your first PHP document, open it in a Web browser by going to http://www.yourdomain.com/yourpath/test.php. For the purposes of my example, my path is actually http://localhost/test/test.php. This tells my Web browser to open my local server and load my new test page. If you do not know the IP address of your host, most environments will allow you to use the computers name (i.e. http://myservername/test/test.php) instead.
If you have followed all the steps above, your server should now be loading and executing PHP pages!
I have installed PHP but keep getting a “Document not found” error. What have I done wrong?
This is a common error. First off, check that you have assigned your PHP folder (c:php by default) the proper permissions. You can do this by right clicking on the PHP folder and switching to the Security tab. Make sure that your anonymous internet user (IUSER) has full permissions for this directory.
If that doesn’t work, check that under your IIS extensions mapping you have checked off “Check that file exists”.
I can not execute PHP index pages. What do I do?
By default, your IIS server does not know that you want to do this. Even the PHP installer doesn’t take the time to add .php files to your servers default list so you’re going to have to do it the old fashioned way
Sunday, april 3, 2005 11:19 aM
ou’ll see a list of files, click the add button to the right of this list (or blank box if nothing is there) and add “” to the list. Now, when you type a url, you do not have to include “” in the title.For example, http://yoursever/yourpath/ now becomes http://yoursever/yourpath/.
Last Reviewed
This article was last reviewed on May 2, 2026 for accuracy and relevance.
Ready for the Next Step?
If this connects to a real challenge your team is facing, I can help you map a next step.
Rate And Review This Content
Found this useful? Leave a quick rating and short review. Approved submissions are stored as testimonials.