views:

356

answers:

4

Hi all,

I want PHP to display parse errors on screen. What I get instead is a blank page. Nothing gets written to server's error log file.

My setup: PHP5.2.9/IIS 6 (not Apache!).

My PHP.INI:

error_reporting=E_STRICT
display_errors = On
display_startup_errors = On
log_errors = On
error_log = "C:\Program Files\Zend\ZendServer\logs\php_error.log"

How do I get parse or fatal errors to be either logged or shown on screen?

Thanks, Temuri

UPDATE: After playing with different switches it looks to be an IIS specific problem. ANY IDEAS FOLKS?

+1  A: 

Try this.

error_reporting(E_ALL);
ini_set("display_errors", 1);
Garrett
parse errors occur before the script is executed.
VolkerK
@VolkerK - That's the thing. Could it be IIS-specific problem?
temuri
A: 

Apache doesn't always like to report parsing errors either. From the command line, run

php -l <file>

The -l switch tells PHP to check file syntax. See the man page.

Chris
A: 

Hi Temuri,

Setting error level in php file itself does not resolve the problem here because the file itself cannot be parsed !!

You need to change error_reporting line in your php.ini as follows:

error_reporting = E_ALL

BTW: There are some examples in php.ini file about what to do to display which type of error messages.

Good luck,

mcemoz

+1  A: 

E_STRICT is not included in E_ALL (until PHP 6). If you want to keep getting E_STRICT

In php.ini:

error_reporting = E_ALL | E_STRICT

At runtime:

error_reporting( E_ALL | E_STRICT );

You'll need to set the error reporting level (and display_errors) in php.ini to see syntax errors. If PHP encounters a syntax error, the runtime doesn't get executed, so setting at runtime won't work. (See the display_errors link.)

James Socol