Monday, October 23, 2006

Configure IIS6 and PHP

The first time I installed PHP in a Windows environment it was IIS5.1. I used the executable and everything configured without a hitch. Some time down the road I had to install PHP on a Windows Server box, which was a little bit more challenging. With so many tutorials online, some of which didn't work correctly or missed a few minor details I decided to give it a shot and write about the steps I took to configure IIS6.

Steps:
1. Download the zip file from http://www.php.net/downloads.php. The executable only seems to work with XP IIS5.1

2. Unzip the contents int c:\php.

3. Add C:\php to the environment path by right clicking on My Computer -> Properties -> Advanced -> Environment variables, then add the "c:\php;" to the path. Make sure you include a semi-colon before and after.

4. Open IIS Manager, navigate to the Web Service Extensions, next click and Add a new Web Service Extension. Enter in the Extension name PHP, click add and navigate to C:\php\php5isapi.dll, finally click OK. Remember to set the extension to allow.

5. Right click the web site you want to configure with php, then choose properties and choose the Home Directory Tab. Click the Configuration button and then click add. On the Add/Edit Application Extension Mappings window, click the browse button and locate C:\php\php5isapi.dll in the extension field enter php. You can keep all verbs enabled or limit to GET, POST, HEAD. Place a check in the Script engine and Verify that file exists and choose OK.

6. While you are still in the Properties page choose the Documents tab and index.php or any page you would like to be the default content page.

7. Navigate to C:\php folder, right click and add the default IUSR for the web service to the permissions. Without this you will get a HTTP 400 Error. Sorry no picture for this one.

8. Copy php.ini-dist from c:\php to C:\Windows and rename it php.ini.
Final step is Restart the web server and test it out.

No comments: