Welcome Guest, Not a member yet? Register   Sign In
error_reporting=0 - bad idea?
#1

[eluser]leonbloy[/eluser]
I had a bad time yesterday when some CI site in production started throwing blank pages and I couldn't find any errors in any log. That was very frustrating. I strongly believe that a application should NEVER swallow fatal errors, relevant errors should ALWAYS go somewhere (log files, normally).

After fixing the problem (just a php compilation error) I went looking after the usual suspects, configuration files (apache, php, codeigniter), etc. I found that, even when I defined in php.ini a log file (error_log directive) CI does not write anything there if there is a compilation error in a view, for example.

Then I found that CI's index.php sets "error_reporting(0);" if a 'production' environment is defined -as was my case. And the docs says that

Quote: You'll find the error_reporting() function located at the top of your main index.php file. Disabling error reporting will NOT prevent log files from being written if there are errors.

Is that really true? That's not the impression I get from my experience, and from the PHP docs. I understand that error_reporting() defines WHAT is reported, and other settings (display_error, error_log) defines WHERE (browser, stderr, files).


If this is so, if error_reporting(0) results in PHP not reporting any errors anywhere, that's a bad setting to use, also in a production system and index.php should be changed.

And if I'm missing something... always glad to learn.
#2

[eluser]leonbloy[/eluser]
In this SO thread both answers coincide: set display_errors = FALSE in production, but don't change error_reporting .




Theme © iAndrew 2016 - Forum software by © MyBB