PHP and IIS have not always got on. My last install was hand crafted, and took some time to get the way I wanted, with the extensions I needed etc.

So, I had the need to install PHP for a customer at work, on what was a new, effectively bare install of IIS, and things have improved somewhat.

After a bit of research, I discovered I needed the following:

1. PHP for Windows, found here: PHP for Windows. Recommended was version 5.3.3 VC9 non-thread safe installer. You may also need the Microsoft 2008 C++ Runtime, which is linked to from the same page.

2. Fast CGI for IIS, found here: Fast CGI for IIS. Follow the on screen instructions to install this.

Since it was a clean install, there were no previous versions involved, I simply installed the Microsoft 2008 C++ Runtime which was appropriate for my OS, installed FastCGI, and finally, ran the PHP 5.3.3 installer, selecting FastCGI from the list presented. I also left the installed extensions as the defaults, however you can opt to install more extensions if you so desire.

By selecting FastCGI, the installer will automatically add the .php extension globally to IIS, so any new sites you create will automatically get the .php extension.

Reboot if you need to, and once the server has restarted, create a file in the root of your default website called ‘phpinfo.php’, and edit it so it contains the following:

<?php
phpinfo();
?>

Using a web browser, visit the default site and specify the phpinfo.php file. If PHP is working, this will display several pages of information about PHP. If not, you’ll need to retrace your steps to see what might have gone wrong.

The most usual problem is that the site does not know what to do with the .php extension, so just check and make sure it matches the global one, and if it doesn’t exist for your site, you can add it using the global definition as a reference.

If you are upgrading, the procedure is much the same, except you must uninstall any previous versions before starting. This will mean your sites are down, so be sure to do it when it will have the least impact. I also took a backup of my old PHP directory as a reference before uninstalling

Also, although the global settings for the .php extension will be updated, you will need to check all your PHP enabled sites to ensure the .php settings match the global settings, or your sites may not work correctly.

That’s it. Not too difficult, just take your time and don’t panic!

« »