Detailed introduction to PHP error log in CLI environment

不言
Release: 2023-04-04 18:26:01
forward
3941 people have browsed it

This article brings you a detailed introduction to the error log of PHP in the CLI environment. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

1. display_errors = Off; //Control whether php outputs errors; output in a production environment will reveal sensitive information; it is recommended to log errors instead of sending them to STDOUT
off: do not display any errors; stderr: Display errors to STDERR (only affects CGI/CLI); On/stdout: Display errors to STDOUT (that is, print errors directly on the screen)
2. log_errors = On; // Record errors to the log specified by the server; STDERR; or the location specified by the error_log directive

3, error_log = /var/log/php_errors.log;//The location specified by the error log

For example, php code:

Print the error directly on the screen. If display_errors is not turned on, it will not be displayed.

The error log specified by error_log will also be displayed

## 4. error_log($message,$message_type,$destination,$extra_headers) function,

message_type defaults to 0, which is sent to the default system log, error_log configuration The specified place; if it is 3, it will be sent to the file specified by the third parameter

error_log("I was an error!");

There will be a record in the error log

The above is the detailed content of Detailed introduction to PHP error log in CLI environment. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:cnblogs.com
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