This article mainly introduces the simple configuration method of php error log, and analyzes in detail the operation skills related to the properties of php.ini and php-fpm.conf file configuration items involved in php error log configuration. Friends in need can refer to it. Next
The example in this article describes how to configure error logs in PHP. Share it with everyone for your reference, the details are as follows:
php.ini:
; 错误日志 log_errors = On ; 显示错误 display_errors = Off ; 日志路径 error_log = "/usr/local/lnmp/php/var/log/error_log" ; 错误等级 error_reporting = E_ALL&~E_NOTICE
##php- fpm.conf:
[global] ; php-fpm pid文件 pid = /usr/local/php/var/run/php-fpm.pid ; php-fpm 错误日志路径 error_log = /usr/local/php/var/log/php-fpm.log ; php-fpm 记录错误日志等级 log_level = notice [www] ; 记录错误到php-fpm的日志中 ;catch_workers_output = yes ; 慢日志 slowlog = var/log/slow.log ; 关闭打印日志 php_flag[display_errors] = off ; 错误日志 php_admin_value[error_log] = /usr/local/php/var/log/www.log ; 记录错误 php_admin_flag[log_errors] = on ; 内存使用量 php_admin_value[memory_limit] = 32M
Note:
If the error log is not Write to the file and check whether the www user has write permission to the path of `php_admin_value[error_log]`
##Others:
`php_flag` Modify the configuration switch form On or Off in `php.ini` and can be modified by `ini_set` `php_value` Modify the configuration value form in `php.ini` can be modified by `ini_set` `php_admin_flag` Modify the configuration switch form On or Off in `php.ini` and cannot be modified by `ini_set`
`php_admin_value` Modify the configuration value form in `php.ini` and cannot be modified by `ini_set` Modify
Related recommendations:
A brief analysis of PHP error handling, automatic loading, stack memory and running modeDetailed explanation of php error levelPHP error handling instance methodThe above is the detailed content of Simple configuration method of php error log. For more information, please follow other related articles on the PHP Chinese website!