Home > Article > Backend Development > How to enable php error log in lnmp environment
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.
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!