Home  >  Article  >  Backend Development  >  How to view php error log under linux

How to view php error log under linux

王林
王林Original
2020-08-17 15:42:299782browse

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.

How to view php error log under linux

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 &#39;<?php phpinfo(); ?>&#39; | 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.

How to view php error log under linux

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!

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