views:

424

answers:

2

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?

A: 

The most reliable way to turn on error reporting is to browse to the directory you installed PHP to, open "php.ini" and change the error_reporting variable in there:

error_reporting  =  E_ALL

In case you're no familiar with the PHP.ini file, double check to make sure that there is NOT a semi-colon at the start of the line.

This is essentially commented out and would be ignored:

;error_reporting  =  E_ALL

So you need to make sure you remove the semi-colon.

Sohnee
I already noted in my question that I had tried that and it doesn't work.
Marty
I was pointing out that a lot of people don't notice that it is still commented out. Try adding E_STRICT also, which isn't included in E_ALL and make sure you re-start IIS once you've made the changes. Check your phpinfo to check the changes have taken effect.
Sohnee
+2  A: 

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.

MidnightLightning