3

I'm running nginx with php-fpm and php 5.3.3. I have in my php.ini config

error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR

Which should turn off all php warnings in the error log but I'm still getting them. How do I get rid of them?

  • 2
    I'd fix the warnings. I consider them nearly as much a bug as a fatal error would be. – Alister Bulman Jan 3 '11 at 10:39
  • try to fix warning with tools like wordpress.... enjoy ;) – Antony Gibbs May 19 '16 at 18:16
2

The setting should work.

php-fpm needs to be restarted as well, not only nginx.
Also, there are various startup (/etc/init.d/) scripts that do perform the right kill job when stopping php-fpm.

Try

  ps -ef | grep php

to get the executable name (like php5-fpm). Then

  killall php5-fpm

(or the name you have).

Then start php-fpm again.

Edit 2016 On most modern unix system

# service php-fpm reload

is the right way to reload configuration (Comment from A.Gibbs)

  • do php assertion warnings count as errors? – Incognito Jan 3 '11 at 19:46
  • Unlike the regular PHP warnings, the assertion warnings come from your own decision to have PHP to react on a given event. You can control this behavior using the assert_options() call. See tuxradar.com/practicalphp/19/8/3 – Ring Ø Jan 9 '11 at 5:38
  • on most modern unix system '# service php-fpm reload' is the right way to reload configuration – Antony Gibbs May 19 '16 at 18:11
  • be careful with service php-fpm reload on some older ubuntu systems (12.04, not sure about 14.04 yet) as reload causes php-fpm to not work correctly, you can use service php-fpm restart without any problems to php-fpm – codivist May 27 '16 at 21:44
2

I believe what you need is to modify the pool and add following:

php_admin_value[error_reporting] = E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED

and reload the FPM

sudo service php5.5-fpm restart

replace with whatever version you use.

  • This is the correct answer – Galvani Nov 14 '16 at 11:31
1

Edit your php-fpm pool configuration to specify an alternate path to log to.

An example: You can edit /etc/php-fpm.d/www.conf and add something like:

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

Or you can turn logging off, but that's a really bad idea.

  • With the above settings, it still shows warnings in the php-fpm error log file. Seems like it overrides the entry for error_reporting given in the php.ini file. – anup Jun 22 '15 at 6:32

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.