I have an issue on one of the web servers where display_errors is set to off in the php.ini file in /etc/php5/apache2/php.ini:

; This directive controls whether or not and where PHP will output errors,
; notices and warnings too. Error output is very useful during development, but
; it could be very dangerous in production environments. Depending on the code
; which is triggering the error, sensitive information could potentially leak
; out of your application such as database usernames and passwords or worse.
; It's recommended that errors be logged on production servers rather than
; having the errors sent to STDOUT.
; Possible Values:
;   Off = Do not display any errors
;   stderr = Display errors to STDERR (affects only CGI/CLI binaries!)
;   On or stdout = Display errors to STDOUT
; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/display-errors
display_errors = Off

Higher up in the file the value is commented out.

However errors and warnings are still are still shown on the webpages.

phpinfo(); shows that display_errors is set to on but I can't understand where it is getting this value from. I'm guessing it must be overridden from somewhere.

Also if I change other options in php.ini then these are reflected in phpinfo but it just seems to ignore the display_errors one for some reason.

Any help would be appreciated.

Thanks Robin


I have now managed to fix this issue after a few hours of looking through config files.

It turned out that I had this code in phpmyadmin.conf in /etc/apache2/conf-enabled/:

<IfModule mod_php5.c>
    php_admin_flag engine on
    php_admin_value display_errors on
    php_admin_value error_reporting 30711
    php_admin_flag ini_set on

This was overriding php.ini for all websites.

As soon as I removed this code it picked up the value from php.ini.

Posting this in case it happens to anyone else as this was not the same solution as posted elsewhere for this problem which was mostly due to editing the commented out version of display_errors or the wrong php.ini file but this was not the case here.


I had the same problem, but in my case was 'cause in "Wordpress" there's a file called "wp-config" where I forget set to "off" in "WP_DEBUG" and "WP_DEBUG_LOG".

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.