Stevp’s Blog
A Stevp into the unknown

Installing PHP 5.2.6 for IIS

May 3rd, 2008 by Stevp

My primary use of Server 2003 is for webserving. I have no aversion to Linux / Apache but the network at work is all Windows. Installing PHP on Server 2003 can be a little awkward so I thought I’d put together another How To detailing the procedure I use.

 width=

For this I will assume you already have IIS installed and are able to access it’s websites from other pcs.

The first thing we need to do is to download the latest PHP version from the website at www.php.net. The top right of their site gives you a quick link to the latest current stable version. At the time of me writing this is 5.2.6. It is always best to use the latest version for new installations. Download the windows binaries zip package (not the installer) for this How To. Once downloaded unzip this to the c:\ drive of your webserver into a folder called “C:\php5″.

I’m going to keep the configuration as simple as possible using as many defaults as possible. Open up the folder and rename php.ini-recommended to php.ini.

 width=

That was the easy bit, now onto IIS, open it up from your Administrative tools menu.

  • Right click the “Web Service Extension” folder and “add new web service extension”
  • Name it php5, in the required files box add c:\php5\php5isapi.dll and allow the extension

There are still a few things we need to do in order to make php work.
On your default site in IIS, right click and go to properties \ home directory \ Configuration
Now choose the Add button. Set the executable path to “c:\php5\php5isapi.dll” and call the extension “.php”.
Click ok and check your default site is allowed to run scripts in the “execute permissions” menu. Next, in the “Documents” tab of the default site add “index.php” to the list of default start pages. (I generally have this at the top of the list)

 width=

Now onto the scarier bits
Open up the run command and type “regedit” to open the registry editor. Regedit can do serious damage to your windows installation so Be Careful. Open up HKLM \ Software and in here create a “PHP” folder, and in it a new string value of “IniFilePath” and give it a value of “c:\php5″. Close Regedit.
Now, open up your system properties page and on the advanced tab open up “Environment Variables”. On the end of the “Path” variable add “;c:\php5″. This will let the system use the php configuration from boot. Now you need to Reboot your server.

Deep breath - Job Done.

Now I suppose we best test this. Open up the directory of your default website and create a file “index.php” open it up with notepad and add the line<?php phpinfo(); ?>and save. Now go to a browser on a different PC and navigate to your default website. In my case http://stevpdc on my local network. If all has been successful you will be faced with a page showing you your php configuration. If you aren’t then reread carefully and check you’ve hit every step.

Posted in How To

5 Responses

  1. gumbald

    Did you use that plugin for markup?

  2. gumbald

    Can you turn off moderation? It’s dull.

  3. Stevp

    No I didn’t use the markup plugin. I used the WP “code” tags. I struggled at first to get it to display the PHP because the page interpreted it. Had to change the < to the html.

    Moderation rocks.

  4. Gary

    what’s a Zip package?

  5. gumbald

    After the event moderation rocks more.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.