Home > Article > Backend Development > Where is the php error log?
1. Related configuration
You need to modify the configuration instructions in php.ini as follows:
1. error_reporting = E_ALL ;将会向PHP报告发生的每个错误 2. display_errors = Off ;不显示满足上条 指令所定义规则的所有错误报告 3. log_errors = On ;开启错误日志 4. log_errors_max_len = 1024 ;设置每个日志项的最大长度 5. error_log = /var/php_errors.log ;指定产生的 错误报告写入的日志文件位置
PHP After the configuration file is set as above, restart the web server. In this way, when executing any PHP script file, all error reports generated will not be displayed in the browser, but will be recorded in the error log /usr/local/error.log specified by you. In addition, not only can all errors that meet the rules defined by error_reporting be recorded, but also a user-defined error message can be sent using the error_log() function in PHP.
2. Check the storage address
1. Check the error log storage address through php.ini
echo '<?php phpinfo(); ?>' | php 2>&1 |grep -i error_log
or output phpinfo in a php file (); Check the error log storage location.
2. Check the log storage location
vi /etc/php.ini
3. Check the log:
tail -f -50 /var/php_errors.log
Recommended tutorial: PHP video tutorial
The above is the detailed content of Where is the php error log?. For more information, please follow other related articles on the PHP Chinese website!