FabianCook FabianCook - 4 months ago 18
PHP Question

Turn error reporting ON xampp

So I have xampp and the thing won't report anything at all... I even forced an error and it didn't do anything...

I used

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


according to this document http://php.net/manual/en/function.error-reporting.php

also
error_reporting(E_ALL);
doesn't do anything either...

Answer

Hey look at that, made a more insane error making code and it works... but why isn't it showing all errors?

Probably you're not getting any 'simple' errors like:

Parse error: syntax error, unexpected T_VARIABLE in .../.../index.php on line 6
#or
Warning: include(whateveryouwantedto.include): failed to open str(...)

But you do get things like:

Fatal error: Call to undefined method stdClass::Crap() in .../.../index.php on line 6

According to my thinking hat, this is because if you don't disable logging in your PHP configuration the 'simple' errors will be sent 'nowhere'. In other words: PHP is 'helping' you by not showing any errors because you either defined log_errors = On and/or error_log = 'php_errors.log' and it's logging all 'real' errors but your's just don't cut it to the 'real' category.

If this doesn't help, the thinking hat says: "It can't f* remember, but I sure as heaven/hell know it is somewhere in the PHP or Apache config."

Sure hope my thinking hat helped you out.

EDIT: Tackling this problem might be to find and open php.ini, select all, delete/backspace, save (but keep open) (or save a copy somewhere). Then restart Apache. See if there's any difference. If so, the php configuration is somewhere else. Restore the php file and search your computer or server from the root up for another php.ini.

Also I think you should make sure :

log_errors = Off
error_log = "./"
display_errors = On
error_reporting = E_ALL

Or in PHP :

error_reporting(E_ALL & E_STRICT);
ini_set('display_errors', '1');
ini_set('log_errors', '0');
ini_set('error_log', './');
Comments