Nginx is a Web server, so nginx access logs will not have PHP error log information only for records that access the page.
Nginx to the PHP request to the PHP-FPM fastcgi process to deal with, the default php-fpm will only output PHP-FPM error message, in PHP-FPM errors log also can't see PHP errorlog
The reason is that PHP-FPM's profile php-fpm.conf The default is to turn off the error output of the worker process and redirect them directly to/dev/null, so we nginx the error log in the And PHP-FPM's errorlog don't see PHP's error log.
It's painful to debug. To resolve Nginx under the PHP-FPM does not log the PHP error logging method:
1. Modify php-fpm.conf the configuration does not increase
Catch_workers_output = yes
Error_log = Log/error_log
2. Modify the configuration in php.ini, no increase
Log_errors = On
Error_log = "/usr/local/lnmp/php/var/log/error_log"
3. Restart PHP-FPM,
When PHP executes an error, it sees the error log in "/usr/local/lnmp/php/var/log/error_log"
1. The Php_admin_value[error_log] parameter in php-fpm.conf overrides the Error_log parameter in php.ini
So make sure that the final error_log file you see in Phpinfo () has writable permissions and that the Php_admin_value[error_log] parameter is not set, otherwise the error log is exported to the PHP-FPM error log.
2. Can not find the php.ini location, using the PHP phpinfo () results to view
3. How to modify the PHP error log does not output to the page or screen
Display_errors = off//Do not display error message (not output to page or screen)
Log_errors = ON//Log error message (saved to log file)
error_reporting = e_all//capture all error messages
Error_log =//Set log file name
Modify the above configuration in the program
Ini_set ("Display_errors", 0)
Ini_set ("error_reporting", E_all); This value seems to be a PHP constant.
Ini_set ("Error_log", "< log file name >")
Ini_set ("Log_errors", 1);
4. How to output the error log of PHP to nginx error log
In PHP 5.3.8 and previous versions, PHP, which ran through fastcgi, encountered errors in user access, first written to PHP errorlog
If PHP's errorlog cannot be written, the error content is returned to the FastCGI interface, and then Nginx is recorded in Nginx errorlog after the error returned fastcgi received
In PHP 5.3.9 and later versions, PHP only attempts to write PHP errorlog, if the failure will not return to the fastcgi, the error log will be exported to the PHP-FPM error log.
So if you want to export the PHP error log to the Nginx error log, you need to use the previous version of php5.3.8, and the PHP error_log for the PHP worker process is not writable in the configuration file