Friday, December 18, 2009

Installing PHP on Windows 7


First of all, you need PHP (obviously). Go to the PHP download page and grab the latest non-thread-safe ZIP archive for Windows. As of writing this, the package is called "PHP 5.2.8 Non-thread-safe zip package". Unzip the archive to a folder on your hard disk (I use C:\php5) and create a copy of php.ini-recommended called php.ini. There, add the following configuration setting:

cgi.force_redirect = 0

Now let's install IIS. "Business" version of Windows 7 is the least needed to have for installing. Go to
Start/Control Panel/Programs/Turn Windows Features on or off and check on the Internet Information Services entry. Activate the World Wide Web Services/Application Development Features/CGI node and also Web Management Tools/IIS Management Console.

Start the IIS Management Console; Open up the start menu, enter inetmgr and hit Enter. There, go to the Sites/Default Web Site/Handler Mappings node and double-click on the "Handler Mappings" entry.

The Actions panel on the right hand side changes. Now you can see an option called Add Module Mapping. Clicking on it opens up a dialog which you fill out as you can see in the following figure.


If you don't see the FastCgiModule entry, you most likely forgot to check the CGI node when installing IIS. Otherwise, close the Add Module Mapping dialog by clicking on OK. Now confirm that you want to create a FastCGI application; click Yes.