How to view the php error log under Linux: 1. Open the php.ini configuration file and enable the error log; 2. Restart the web server; 3. View the error log storage location; 4. Execute [tail -f 50 /var/php_errors.log] command to view the error log.
Specific method:
(Recommended tutorial:php graphic tutorial)
1. Editing the configuration file
requires the following modifications to the configuration instructions in php.ini:
error_reporting = E_ALL; 将会向PHP报告发生的每个错误 display_errors = Off; 不显示满足上条 指令所定义规则的所有错误报告 log_errors = On; 开启错误日志 log_errors_max_len = 1024; 设置每个日志项的最大长度 error_log = /var/php_errors.log; 指定产生的 错误报告写入的日志文件位置
Restart the web server after completion.
2. Check the storage address
1. Check the error log storage address through php.ini
echo '' | php 2>&1 |grep -i error_log
(Video tutorial recommendation:php video tutorial)
Or output phpinfo(); in a php file to 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
The above is the detailed content of How to view php error log under linux. For more information, please follow other related articles on the PHP Chinese website!