PHP gets server error log

Release: 2023-02-27 22:30:02
Original
2663 people have browsed it

PHP gets server error log

Configuration and viewing logs

1. Related configuration

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 Enter the log file location

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 the log storage location

vi /etc/php.ini
Copy after login

3. View the log:

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

Recommended:

php server

The above is the detailed content of PHP gets server 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
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!