Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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...

like image 712
FabianCook Avatar asked Oct 04 '12 22:10

FabianCook


3 Answers

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', './');
like image 176
Bas van Ommen Avatar answered Oct 20 '22 09:10

Bas van Ommen


error_reporting function is sometimes turned off on local servers, for example, Xampp does not support it so you have to go to php.ini and change it there. Hope this helps :).

like image 27
Gaming With Kman Avatar answered Oct 20 '22 09:10

Gaming With Kman


In your folder xampp/php create new folder named logs. Go to control panel appache logs click php_error_log it will now ask if you want to create the file.

like image 39
Gary Owain Jones Avatar answered Oct 20 '22 09:10

Gary Owain Jones