Trying without succes to make apache display on screen errors on our development server. Basically I understand that my:

error_reporting  =  E_ERROR & E_RECOVERABLE_ERROR & E_STRICT

Has no effect over:

display_errors = On

As this will also insist in displaying all PHP notices as well. I was hoping that only the specified error level on the PHP ini would have effect over the display_errors directive but so far I have not managed to get it working.

Apache 2.2, PHP 5.3 on Ubuntu 9


You're trying to filter specific types of notices, correct? The PHP manual shows a couple ways of doing this.

First, you can allow which errors to be reported by specifying the type followed by a pipe character (|) for each specified type. Second, if your intention is to remove a specified type you can use the caret character (^) (or NOT operator).

If you only want simple errors and warnings reported:

<?php display_errors(E_ERROR | E_WARNING); ?>

If you want to report all errors, but leave out error notices:

<?php display_errors(E_ALL ^ E_NOTICE); ?>

The only objective of display_errors is for visual purposes only and save you trips to the log file. All errors are logged regardless in a special log file.

  • Thanks but I have no issue with understanding the level reporting setup for PHP but I don't think that display_errors supports "levels" but just on/off in which case I get even INFO level. I'll try it. Thanks. – luison May 10 '11 at 22:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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