Nginx and php-fpm log Configuration tutorial

Source: Internet
Author: User
Tags fpm

After nginx and php are configured, no logs are found for php-error. Google finally got it done, mainly to the php-fpm.conf and php. ini to make the following changes:

1. Modify php-fpm.conf

Modifying the worker process configuration for www. conf under the pool. d may also be to output the error message. By default, the error log of the worker process is redirected to/dev/null.

; Redirect worker stdout and stderr into main error log. If not set, stdout and
; Stderr will be redirected to/dev/null according to FastCGI specs.
; Note: on highloaded environement, this can cause some delay in the page
; Process time (several MS ).
; Default Value: no
Catch_workers_output = yes

2. Modify the configuration in php. ini.

Modify the configuration in php. ini to prevent php from outputting error information to the webpage, but to the file system.

Display_errors Off
Log_errors On
Error_log/var/log/php/php_errors.log

Now the configuration is complete, but note that the worker process of php-fpm must have the write permission for log files. Check the owner of the php-fpm worker process.

Ps aux | grep php-fpm

For example, in my system, the owner of the php-fpm master process is root, and that of the php-fpm worer process is www-data, for me, you only need to set the owner and group of the directory/var/log/php/To www-data.

Related Article

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.