在nginx中,nginx只對頁面的訪問做access記錄日誌。不會有php的error log 信息。nginx把對php的請求發給php-fpm fastcgi進程來處理,默認的php-fpm只會輸出php-fpm的錯誤信息,在php-fpm的errors log裏也看不到php的errorlog。
原因是php-fpm的配置文件php-fpm.conf中默認是關閉worker進程的錯誤輸出,直接把他們重定向到/dev/null,所以我們在nginx的error log 和php-fpm的errorlog都看不到php的錯誤日誌。
所以我們要進行如下的設置就能查看到nginx下php-fpm不記錄php錯誤日誌的方法:
1,修改
error_log = /alidata/log/php/php-fpm.log
=============================================華麗的分割線=============================================
[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"