0

Is there any way to disable error logging in php5-fpm?

I changed the /etc/php5/fpm/php.ini file with:

log_errors = Off
display_errors = Off

and restarted php5-fpm.

My nginx logfiles are still full of php warnings.

4
  • Did you check that was the ini file used by PHP?
    – symcbean
    May 25, 2012 at 9:26
  • I can't find another php.ini file May 25, 2012 at 12:27
  • 1
    Don't search - simply create a page with phpinfo() on it. If you have got the right page, then check you're not overriding the behaviour via http config / .htaccess by adding a page which reports what values it sees using ini_get()
    – symcbean
    May 26, 2012 at 11:38
  • Please copy example of the error from the logfile
    – GioMac
    Aug 18, 2013 at 14:24

4 Answers 4

1

Edit php-fpm.conf and set error_log= to empty, or /dev/null.

1
  • php-fpm.conf contains the following line error_log = /var/log/php5-fpm.log, but php warnings/errors are logged in /var/log/nginx/error.log May 25, 2012 at 12:21
1

It's Nginx that is logging these errors.

Taken from http://wiki.nginx.org/CoreModule:

Note that error_log off does not disable logging - the log will be written to a file named "off". To disable logging, you may use:

error_log /dev/null crit;

in your nginx.conf file, usually located in /etc/nginx/nginx.conf

0

Check your php-fpm configuration for:


php_admin_value[error_log] = /var/log/php-fpm/www-error.log
php_admin_flag[log_errors] = on

And comment this out.

3
  • /etc/php5/fpm/php-fpm.conf doesn't contain these lines. May 25, 2012 at 12:13
  • In my instalations there is directory called /etc/php-fpm.d check config files there for those two lines
    – B14D3
    May 25, 2012 at 12:51
  • I don't have this directory. It's something very strange. A few days ago installed php5-fpm+nging on another (dedicated) server and it doesn't log php warnings/errors. Yesterday I installed the same things on VPS and now this problem. Don't know how to solve it. Temporary solution is ini_set('log_errors', 0); May 25, 2012 at 14:47
0

It's Nginx not php who write this log. You need to edit your nginx config to log only critical error (note that you cannot disable error logging, but you can change the log level). And note that you should fix errors instead of hide them ^^

You must log in to answer this question.

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