Marty
Marty

Reputation: 2666

Error reporting while running under IIS

I am trying to get my install of PHP under IIS to display errors, but I'm having no luck at all. I tried

error_reporting(E_ALL);

in the script, and nothing shows up, just a blank screen.

I tried editing my PHP.ini file and setting

error_reporting = E_ALL
display_errors = On

Also tried

error_reporting = E_ALL
display_errors = stdout

but nothing is showing up on the screen at all when my scripts throw errors.

Any advice?

Upvotes: 5

Views: 13146

Answers (4)

bJacoG
bJacoG

Reputation: 170

Perhaps IIS is blocking your errors from displaying. Try:

  • Open inetmgr (Start -> Run -> inetmgr -> enter)
  • click on the site
  • select error pages (double click on it)
  • on the right hand side click on “Edit Feture Settings”
  • In the dialog that appears, select “Detailed Errors”.
  • Save and close.
  • Restart IIS just to be sure.

Posted for the sake of googlers like me.

Upvotes: 4

Andy
Andy

Reputation: 2140

Sorry to resurrect a dead post but I had a similar issue and solved it by doing this in my PHP code:

ini_set('display_errors',1);
error_reporting(E_ALL);

This obviated the need to edit the server config and also allowed me to do this in just the method that I thought was problematic.

Upvotes: 4

MidnightLightning
MidnightLightning

Reputation: 6928

Ensure that you're editing the PHP file in the correct location; IIS can look for a php.ini file in C:\WINDOWS rather than the install location of the PHP ISAPI or CGI module. Check the output of phpinfo(); to determine you're editing the correct php.ini file. Also, you need to restart the IIS service (or the computer overall) before those changes will be put into effect.

Upvotes: 4

Related Questions