How to Show PHP Error Messages on IIS 7

iis-7PHP

I am using IIS as a webserver on my development machine for PHP webdevelopment. Or at least, I am trying to.

When there is a syntax error in a PHP script and I open that file in my webbrowser, I just get an 503 "internal server error" and the default IIS error page for this error. Some browsers dont open that file at all, possibly because of the 503 HTTP Response Header.

I would like IIS to act in that case just like the apache webserver: display the PHP file with the error anyway, so that the error message gets printed out.

How can this be done?

EDIT:

PHP settings:

display_errors

is on and

error_reporting

is set to E_ALL

Best Answer

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

You can set it by running the following (make sure to replace {sitename} with your site name).

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