Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
share|improve this question
What 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. – WerkkreW Apr 2 '12 at 17:53
Strict Standards: Non-static method Flyspray::absoluteURI() should not be called statically in /home/admin/ on line 30 – Spacedust Apr 2 '12 at 18:43
up vote 3 down vote accepted

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.

share|improve this answer
It doesn't work. – Spacedust Apr 2 '12 at 20:50
error_reporting = (E_ALL ^ E_STRICT)

could this help?

share|improve this answer
Welcome 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 :-) – voretaq7 Feb 21 '14 at 5:41

Regular methods are meant to be called from an INSTANCE of a class (Object).

Like this: $object = new Class(); $object->function();

However you are calling it straight from the class.

Like this: class::function();

Here is what STATIC methods are for.

change this: public function absoluteURI()

To this: public static function absoluteURI()

I recommend you always code stricly, so NOT turn off the strict errors. Why? Your example proves it. You were using a regular method to do something it shouldn't do.

So instead of of turning off the strict errors, make these easy minor fixes to your code :) It's worth it, i promise.

A good programmer is always open to neater coding, and will take the time to learn it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.