php view error log

Release: 2023-02-28 07:00:02
Original
3876 people have browsed it

php view error log

php Check the error log:

1. Related configurations

You need to modify the configuration instructions in php.ini as follows:

1. error_reporting = E_ALL ; Every error that occurs will be reported to PHP

2. display_errors = Off ; All error reports that meet the rules defined in the previous directive will not be displayed

3 , log_errors = On ; Turn on the error log

4, log_errors_max_len = 1024 ; Set the maximum length of each log item

5, error_log = /var/php_errors.log ; Specify the generated Error report The location of the written log file

After the PHP 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 the error_log() function in PHP can be used to send a user-defined error message.

2. Check the storage address

1. Check the error log storage address through php.ini

echo '' | php 2>&1 |grep -i error_log
Copy after login

Or output phpinfo() in a php file; check the error log Storage location

2. View log storage location

vi /etc/php.ini
Copy after login

3. View log:

tail -f-50/var/php_errors.log
Copy after login

Recommendation:php server

The above is the detailed content of php view error log. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!