大网数据广告活动
服务器运维问答

nginx php-fpm how to disable log warnings?

· 52CE 我爱测

I've a setup with nginx + php-fpm. I found in my nginx error log a lot of PHP Warning messages like this: 2016/03/17 20:57:23 [error] 23002#0: *114868 FastCGI sent in stderr: "PHP message: PHP Warning: Declaration of Walker_Categ…

问题原文

原帖链接 · Fabio · CC BY-SA 3.0

I've a setup with nginx + php-fpm. I found in my nginx error log a lot of PHP Warning messages like this:

2016/03/17 20:57:23 [error] 23002#0: *114868 FastCGI sent in stderr: "PHP message: PHP Warning:  Declaration of Walker_Category_Filter::start_el(&$output, $category, $depth, $args) should be compatible with Walker_Category::start_el(&$output, $category, $depth = 0, $args = Array, $id = 0) in /var/www/wp-content/themes/venture/functions/theme/custom-post-types.php on line 0
PHP message: PHP Warning:  Parameter 1 to W3_Plugin_TotalCache::ob_callback() expected to be a reference, value given in /var/www/wp-includes/functions.php on line 3464", client: 52.69.241.233, server: www.myhost.net, request: "GET /appuntamenti/ HTTP/1.1", host: "www.myhost.net"

I don't want to log event like this, they fill up my logs and create a lot of rumors on New Relic reports. Do you knwow ho to change this behavior of nginx?

I've tried to change my php.ini configuration with this:

 error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR

The event are logged in nginx error log, so I think that's not related to php-fpm configuration.

Any suggestion is welcome

Thanks Fabio

已采纳解答

原帖链接 · Xiong Chiamiov · CC BY-SA 3.0

Those are warnings generated by PHP itself; since they're printed to stdout (or maybe stderr) without being caught, they end up in your server logs.

I would expect that entry in your php.ini to be sufficient to silence those warnings. If that is not happening, you should check to see if the application overrides those settings through the error_reporting() function.

In general, you should pay attention to warnings - they are warnings after all! Whoever is responsible for maintaining the application (that might be you) should look into them and fix them; silencing them in your logs is just papering over the issues, and may come back to bite you in the ass.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-03-17)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。