Recently built in the local LNMP development environment. In order to develop the time does not affect the normal development of the front of the block PHP php inside.INI with some error hints. But in this way, it affects some of the problems of back-end development, such as not timely debugging some problems in development. Nginx and Apache are not the same, in Apache can directly specify the PHP error log, so that the error message in PHP execution directly into the PHP error log, can be easily queried. In Nginx, things become like this: Nginx only access to the page to do access logging. There's no PHP error.LogInformation. Nginx to the PHP request to the PHP-FPM fastcgi process to handle, the default PHP-FPM will only output PHP-FPM error message, in php-the errorlog of PHP is not visible in FPM's errors log. The reason is that PHPThe default in-FPM profile php-fpm.conf is to turn off the worker process error output and redirect them directly to/dev/NULL, so we're in Nginx's errorLogand php-FPM's errorlog do not see the PHP error log. So we have to make the following settings to see the nginx under the PHP-FPM does not record the PHP error log method:
1, modify the configuration in the php-fpm.conf, if not please add:[Global]; Note: thedefaultPrefix is/usr/local/php/varError_log=Log/Php_error_log[www]catch_workers_output=Yes2. Modify PHP.INI configuration, no increase log_errors= onError_log= "/usr/local/php/var/log/error_log"error_reporting=E_all&~E_notice3. Restart php-FPM, when PHP executes an error, you can see the error log in the "/usr/local/lnmp/php/var/Log/Php_error_log "In If it appears:[[email protected] etc]#Service php-fpm RestartGracefully shutting down php-fpm. DoneStarting PHP-FPM [17-apr-2014 18:40:52] ERROR: [/usr/local/php/etc/php-fpm.conf:5] Unknown entry 'catch_workers_[17-apr-2014 18:40:52] error:failed to load configuration file'/usr/local/php/etc/php-fpm.conf '[17-apr-2014 18:40:52] ERROR:FPM initialization failed failed then, in the first step, carefully write the configuration to the corresponding group, otherwise it will appear above: error: [/usr/local /php/etc/php-fpm.conf:5] Unknown entry ' catch_workers_output '
Configuring PHP error messages in LNMP environment