Install PHP 5.3 on IIS 7 Windows 2008 SP2

phpTShirtIn this post I’ll write about installation process of PHP 5.3 on Windows 2008 SP2 (not R2), with Sql Server support.
After some headcaches I’ve found that in Windows 2008 SP2 (NOT R2) it is possibile to install PHP 5.3 at most: with subsequent releases version the Sql Server driver for PHP won’t work in any way (missing depencies and other problems).

InstallationWindows2008-Install-IIS-Step01 Process
1) Install IIS with CGI support
2) Install Windows Power Shell
3) Apply all update & Service Pack
4) Dowload Microsoft Web Platform Installer 5.0 (see linkografia)
5) Launch wpilauncher.exe
6) Select Framework -> PHP 5.3.19, and confirm
7) Once the installation process is finished, PHP & SQL Server driver for PHP should be up and running, but we will cWindows2008-Install-IIS-Step02heck ! Load up the IIS Manager: it’s under Administrative Tools in Control Panel, or you can type IIS into your Start menu search bar.
8) Here the installation process has simply added and enabled certain required components (i.e. PHP manager). IIS will be executing PHP via the FastCGI module (the recommended method for IIS). Select the top entry for your server under Connections on the left, and double-click on Modules: you should see FastCgiModule in this list. If not, click Configure Native Modules on the right, and enable the FastCgiModule.
9) Now select Default Web Site and open Handler Mappings list: the installer should have added an entry titled PHP53_via_FastCgi. However, if this option doesn’t appear in the list, click Add Module Mapping on the right, enter *.php as the request path, select FastCgiModule from the module list, and select your php-cgi.exe binary for the path—this should be in C:\Program Files\PHP\php-cgi.exe or something similar (remember to use quotes around the executable path, because of that space in path of Program Files.) Select a name like PHP via FastCgi, and click OK.

Now we’re ready to run our PHP applications under IIS: the default website will have a document root similar to C:\inetpub\wwwroot: here you can remove the default IIS files and create an index.php file. Open up your favourite text editor and add the following:

<?phpphpinfo();?>

Open your web browser and visit http://localhost/index.php: search for sqlsrv, which is the native SQL Server driver for PHP that’s provided by Microsoft.

Linkografia
Microsoft Web Platform Installer 5.0