This article summarizes the usage of php display_errors and log_errors. Students who need to know more can refer to this article.
display_errors
Error echo is commonly used in development mode, but many applications forget to turn off this option in the official environment. Error echo can expose a lot of sensitive information, which facilitates the attacker's next attack. It is recommended to turn this option off.
display_errors = On
When it is enabled, if an error occurs, an error will be reported and an error message will appear
dispaly_errors = Off
In the closed state, if an error occurs, it will prompt: Server error. But no error message will appear
You can define the switch programmatically like this
//ini_set("display_errors","On"); //Display all error messages*/
ini_set("display_errors","Off"); //Shield all error messages
What should be noted here is that usually in the server configuration file, notice errors are blocked and only error errors are displayed. If this is the case, if you turn on the error display, the notice error will not be displayed
log_errors
Just use this in a formal environment and record the error information in the log. Just in time to turn off error echo.
Set whether to record script running error information to the server error log or error_log. Note that this is a server-specific configuration item.
Note:
In production systems, it is strongly recommended that you use error logging to record error messages displayed on the web site.
log_errors_max_len integer
Set the maximum number of bytes in log_errors. Information about the source of the error will be added to error_log. The default value is 1024. If set to 0, there is no limit to the length. This length setting limits logged errors, displayed errors, and $php_errormsg.
When using integer, its value is measured in bytes. It is also possible to use the shorthand notation described in the FAQ.