所以我们要进行如下的设置就能查看到nginx下php-fpm不记录php错误日志的方法:
1,修改
php-fpm.conferror_log = /alidata/log/php/php-fpm.log
catch_workers_output = yes 2,修改 php.ini log_errors = On 3,重启php-fpm service php-fpm restart
=============================================华丽的分割线=============================================
出错信息 当调用webji的php webservicd 接口时候报错 1,只是在页面上看到500的错误, 2,在nginx的 access log 中能看到 500 返回码 58.247.1.218 - - [15/Aug/2016:16:05:35 +0800] "GET /?route=user/user/pay_problem HTTP/1.1" 500 112 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.3 (KHTML, like Gecko) Version/8.0 Mobile/12A4345d Safari/600.1.4" 3,而在nginx的error log中 无任何输出 所以必须先把error log呈现出来,通过上面配置 监听 /alidata/log/php/php-fpm.log,得到如下log [16-Aug-2016 09:59:06] WARNING: [pool www] child 12539 said into stderr: "NOTICE: PHP message: PHP Warning: fopen(/alidata/www/jx_financial/system/logs/error.log): failed to open stream: Permission denied in /alidata/www/jx_financial/system/library/log.php on line 6" [16-Aug-2016 09:59:06] WARNING: [pool www] child 12539 said into stderr: "NOTICE: PHP message: PHP Warning: fwrite() expects parameter 1 to be resource, boolean given in /alidata/www/jx_financial/system/library/log.php on line 10" [16-Aug-2016 09:59:06] WARNING: [pool www] child 12539 said into stderr: "NOTICE: PHP message: PHP Warning: fwrite() expects parameter 1 to be resource, boolean given in /alidata/www/jx_financial/system/library/log.php on line 10" [16-Aug-2016 09:59:06] WARNING: [pool www] child 12539 said into stderr: "NOTICE: PHP message: PHP Warning: fwrite() expects parameter 1 to be resource, boolean given in /alidata/www/jx_financial/system/library/log.php on line 10" [16-Aug-2016 09:59:06] WARNING: [pool www] child 12539 said into stderr: "NOTICE: PHP message: PHP Warning: fwrite() expects parameter 1 to be resource, boolean given in /alidata/www/jx_financial/system/library/log.php on line 10" [16-Aug-2016 09:59:06] WARNING: [pool www] child 12539 said into stderr: "NOTICE: PHP message: PHP Fatal error: Call to a member function get() on a non-object in /alidata/www/jx_financial/index.php on line 114" 至此,知道是文件权限问题, chown www:www system -R 问题解决
