Thursday, November 19, 2009

Installing PHP on Windows 7

If you've wrestled with installing PHP on IIS before, there's good news. Installing PHP in Windows 7 is easy. Super easy. Microsoft has created the Web Platform Installer (WPI), which supports installing many things, PHP included.

If you look in the IIS Manager, down at the bottom of the rows of icons you should see Web Platform Installer. If you don't see it there, go to your Start menu and search for "platform".

Check off PHP and let it install. There are a couple of dependencies that will be added automatically.

There's one more change you need to make after PHP is installed, which is to add "index.php" to the list of Default Documents.

There are some other things you should know:
  • WPI correctly installs PHP even on a 64-bit system. There's no need to use cscript to separately change configurations.
  • Apparently, there's still no 64-bit version of PHP for Windows. WPI installs the 32-bit version, which works correctly even under the 64-bit version of IIS.
  • There's no uninstall option. However, everything is installed to a single directory and removing the relevant FastCGI settings is straightforward.
  • The correct strategy for upgrading to new versions of PHP isn't obvious. I'm not sure if Microsoft used the stock build of PHP or if they created a custom one.
One small gotcha - WPI installs PHP 5. If this is your first encounter with PHP 5, you need to make sure you use <?php ... ?> as opposed to <? ... ?>.

1 comment:

  1. For those who use Windows XP/Windows Server 2003 I've written a small manual install guide for FastCGI + PHP5 installation:

    Installing PHP 5 on IIS 5.1/IIS 6.0 with FastCGI

    ReplyDelete