Home > Article > Backend Development > Detailed introduction to PHP error log in CLI environment
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
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!