show php error message on IIS 7

Solution 1:

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

Solution 2:

To enable detailed errors for PHP (and other languages), run this command from the command line:

%windir%\system32\inetsrv\appcmd.exe set config -Section:system.webServer/httpErrors -errorMode:Detailed

Then

IISReset

Solution 3:

A best practice would be to log "silently" in a file.

But you can have both by setting the following value in your php.ini file to a logfile

error_log=<File Location>

Solution 4:

Include the following two lines at the top of your PHP script

ini_set('display_errors','On');

error_reporting(E_ALL | E_STRICT);