Installing PHP & MySQL on IIS7

The problem was getting PHP to tun on IIS, you need to choose to either do it as an ISAPI Module or through CGI (for development purposes there’s no real difference but for production there is better performance through ISAPI). After choosing ISAPI I found out that some specific libraries weren’t being loaded to control Data Bases (for me it was php_mysql.dll but this probably happens for php_mysqli.dll, postgre, oracle, mssql, etc) when the PHP script was running from IIS (if executed from command line everything was ok, but who would want to do that? Setting up PHP and MySQL is most definetely for Web, so obviously we’d want PHP script to run on IIS (or hell, you might be some left behind forever nerd developing Web scripts through command line, in which case, shoot yourself)). On the other hand there seemed to be an issue with SESSION if you chose using CGI, but I chose the first option.

When mapping PHP to ISAPI there’s one more thing to do: add an ISAPI filter pointing to the exact same .dll from PHP (probably php5isapi.dll) and done! No switching libmysql.dll versiones, no looking through configuration files for hours!

I found this guide after solving the thing:

http://www.canerten.com/php-installation-with-extensions-mysql-for-iis7-in-windows-vista/

Not very a popular subject but believe me, if you don’t arrive here by accident you’ll thank me.

Cheers,
Gorka

TOP NEWS - Kill whoever developed IIS7, change everything: take out everything about the ISAPI filters for PHP, and take the handler (it used to be php5isapi.dll) to php-cgi.exe and kill anyone that works for Microsoft.
Once everything seemed to work with the mysql extension some other libraries start failing, with me it was curl, ergo…

http://bugs.php.net/bug.php?id=39163

Leave a Reply