Tuesday, June 15, 2010

Display PHP error messages on IIS 7.0 / 7.5

Have you ever tried running PHP on IIS with FastCGI? Yes, it runs, and it does it smoothly. However regardless of php.ini settings for “display_errors” and “error_reporting”, starting with IIS 7.0, you will most probably see only “Internal Server Error 500.XX” for any error generated by PHP (even if it is just a warning or even notice). And yes, the hard workaround is to turn on Failed Request Tracing on the site, and examine FRT log files. Which I’m sure you don’t want!

The solution is here: http://serverfault.com/questions/69839/show-php-error-message-on-iis-7

The reason:

With IIS7, it doesn't pass the errors through by default. It's "existingResponse" that needs to be set.

The solution (run this line with elevated command prompt):

c:\windows\system32\inetsrv\appcmd.exe set config "{sitename}" -section:system.webServer/httpErrors /existingResponse:"PassThrough" /commit:apphost

and do not forget to replace {sitename} with the real site name.