Home  >  Article  >  Backend Development  >  How to enable php error log in lnmp environment

How to enable php error log in lnmp environment

王林
王林Original
2020-10-20 14:06:353309browse

How to enable the php error log in the lnmp environment: first open the php-fpm.conf configuration file; then add [php_admin_flag[log_errors] = on]; and finally restart php-fpm.

How to enable php error log in lnmp environment

Errors under LNMP need to be set in /usr/local/php/etc/php-fpm.conf, add catch_workers_output = yes, and the error message will be It will be recorded to the file set by error_log in php-fpm.conf.

(Recommended tutorial: php video tutorial)

or add

php_admin_value[error_log] = /usr/local/php/var/log/php-error.log
php_admin_flag[log_errors] = on

to php-fpm.conf. Both of the above methods will work. Restart php. -fpm takes effect

Similarly, display_errors in php.ini also needs to be set in php-fpm.conf. Add php_flag[display_errors] = On to enable it.

Sometimes the error log file may not be created automatically, you can execute:

touch /usr/local/php/var/log/php-error.log && chown www:www /usr/local/php/var/log/php-error.log

Related recommendations: php training

The above is the detailed content of How to enable php error log in lnmp environment. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn