Try as I may, I can't suppress error messages from PHP (using php-fpm) being displayed.

Relevant files;

/etc/php5/fpm/php.ini:display_errors = Off
/etc/php5/fpm/pool.d/www.conf:php_flag[display_errors] = off
/etc/php5/fpm/pool.d/www.conf:php_admin_flag[display_errors] = off
/etc/php5/cli/php.ini:display_errors = Off

When I call phpinfo() the output is as follows [images as links as this is my first post and therefore don't have sufficient reputation to put them inline, sorry!];

https://i.sstatic.net/4ttGt.png https://i.sstatic.net/4LAah.png

The above shows the Configuration File Path as /etc/php5/fpm and the Loaded Configuration File as /etc/php5/fpm/php.ini. The second image shows display_errors and display_startup_errors as Off.

Which suggests that these settings have been correctly set, but loading a page with errors results in pages of errors e.g;

Unknown: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /path/to/file.php on line 651****Unknown: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /path/to/file.php on line 651

(formatted as above, so the HTML formatting is being applied)

I've also tried setting ini_set("display_errors", 0); and even error_reporting(0); to no avail.

Also, edited to add;

# php5-fpm -i | grep error
display_errors => Off => Off
display_startup_errors => Off => Off
error_append_string => no value => no value
error_log => /var/log/php_err.log => /var/log/php_err.log
error_prepend_string => no value => no value
error_reporting => 22527 => 22527
html_errors => Off => Off
ignore_repeated_errors => On => On
log_errors => On => On
log_errors_max_len => 1024 => 1024

What am I missing?

Versions are as follows;

Debian 8 Jessie

PHP 5.6.30-0+deb8u1

Nginx 1.6.2

1 Answer 1


Is this plain PHP or do you run code with some kind of framework?

It is rather common for recent frameworks to reconfigure error reporting on the fly and/or registering a custom error handler, so maybe something in your program reconfigures it again?

  • Thanks for the quick response, It affects both an online store running OpenCart (which may use a variety of frameworks), but also a really simple test script I threw together.
    – Ross
    Jun 3, 2017 at 23:50
  • Also, having greped through the entire code base with grep -R "display_err" * there's no reference to anything that would seem to override it :/ (and it was fine on Apache before)
    – Ross
    Jun 3, 2017 at 23:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .