Configuring PHP error messages in LNMP environment

Source: Internet
Author: User
Tags fpm php error php error log

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.