Hide STRICT errors on PHP 5.4
In PHP 5.4 E_STRICT became part of E_ALL - (documentation). My recommendation would be to turn the directive to display errors to off, and to log errors instead, this would be done by setting the following in your php.ini:
display_errors = off
log_errors = on
error_log = /path/to/logs/php_error.log
If you do not want to go down this route and still wish to display errors and simply emulate the PHP <5.4 functionality you would be best off doing something like this:
error_reporting = E_ERROR | E_WARNING | E_PARSE
It should also be mentioned that various people have reported the inability to exclude E_STRICT from E_ALL in such a way as you have tried as a bug, so this might change in a later release to allow for the functionality you are used to.
Related videos on Youtube
Spacedust
Updated on September 18, 2022Comments
-
Spacedust over 1 year
I've upgraded from PHP 5.3 to PHP 5.4 today. Now my script is displaying a lot of error messages. How to hide them without using
error_reporting(0);
inside php file ?I use this:
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT
-
WerkkreW about 12 yearsWhat type of errors is it showing, that will help us know what reporting settings will hide them. As a side note, you should probably have error logging enabled, and display of errors totally disabled.
-
Spacedust about 12 yearsStrict Standards: Non-static method Flyspray::absoluteURI() should not be called statically in /home/admin/prace.jobs.pl/includes/constants.inc.php on line 30
-
-
Spacedust about 12 yearsIt doesn't work.
-
voretaq7 about 10 yearsWelcome to Server Fault - this is a VERY old question - if you are going to provide an answer to something this old please take the time to compose an excellent answer (providing a solution and an in-depth explanation of WHY your solution works). Just providing a line for someone to drop into a configuration file is not generally what we're looking for in an answer. Thanks :-)