...

View Full Version : My error reporting isn't working



jeddi
02-12-2010, 09:07 AM
I start off my code with this:



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

But despite that, when I get an error all I get is a blank screen :(

This started happening yesterday and I can't figure out why !




.

Dormilich
02-12-2010, 09:24 AM
maybe you have a fatal error …

display_errors string

This determines whether errors should be printed to the screen as part of the output or if they should be hidden from the user.

Value "stderr" sends the errors to stderr instead of stdout. The value is available as of PHP 5.2.4. In earlier versions, this directive was of type boolean.

Note: Although display_errors may be set at runtime (with ini_set()), it won't have any affect if the script has fatal errors. This is because the desired runtime action does not get executed.

jeddi
02-12-2010, 09:45 AM
But if I have a fatal error would I not get a server error
rather than a blank html page ?

EDIT:

I just checked my server log and it IS a normal parse error:

PHP Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/coachman/public_html/coaching1.php on line 76

So I don't know why it isn't being sent to the page !



.

Dormilich
02-12-2010, 09:49 AM
not necessarily, a fatal error like E_ERROR just terminates your script (it’s not an error that makes PHP crash), leaving the server unaffected. how PHP handles that, depends on its settings. it can well be that you don’t get visual output with fatal errors.

jeddi
02-12-2010, 10:19 AM
Possibly I did my edit after you
replied :



I just checked my server log and it IS a normal parse error:

PHP Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/coachman/public_html/coaching1.php on line 76

So I don't know why it isn't being sent to the page !





.

Dormilich
02-12-2010, 10:58 AM
Possibly I did my edit after you replied
definitely.

what PHP version do you have?

jeddi
02-12-2010, 06:09 PM
php 5.2.9

Dormilich
02-13-2010, 12:19 AM
may I point out again, that display_errors ain’t a boolean anymore?

jeddi
02-13-2010, 05:57 AM
Thanks,
so what string should I place in here to make it
display to screen ?


ini_set ("display_errors", "string");



.

JAY6390
02-13-2010, 03:45 PM
ini_set('display_errors', 'On');
error_reporting(E_ALL);
better still, do this in a .htaccess file. Add

php_flag display_errors On
php_value error_reporting 30719
Note that it's not advised to do this on a production server, only the development server. If you have access to the php.ini do this directly changing error_reporting and display_errors in the php.ini file, then restarting your server

melvincmk
08-12-2010, 02:19 PM
If you have root access, check if you have other php.ini in your system eg. /etc/php5/apache2filter/php.ini
Make sure error reporting is turned on in those files as well.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum