I. Related configurations
The configuration directives in php.ini need to be modified as follows:
error_reporting = E_all; Every error that occurs will be reported to PHP
Display_errors = OFF; do not display all error reports that meet the rules defined by the previous instruction
Log_errors = on; open error log
Log_errors_max_len = 1024; Sets the maximum length for each log entry
- Error_log =/var/php_errors.log; Specifies the log file location where the resulting error report is written
The PHP configuration file is set up as above and restarts the Web server. Thus, 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 that you specified. In addition, you can not only record all errors that meet the rules defined by error_reporting,
You can also use the Error_log () function in PHP to send a user-defined error message.
Two. View storage address
1. Use PHP.ini to view the error log storage address
Echo ' <?php phpinfo ();?> ' | PHP 2>&1 |grep-i error_log
or output phpinfo () in a php file; see where the error log is stored
2. View Log storage location
Vi/etc/php.ini
3. View the log:
Tail-f -50/var/php_errors.log
In addition to the general error output, PHP also allows custom messages to be sent to syslog in the system. Although a custom message can be sent to the syslog using the Error_log () function described previously, there are 4 specialized functions that need to be used in PHP for this feature.
And share the time I've done. Cylindrical formwork industry Platform: http://zhimo.yuanzhumuban.cc/
PHP error Log notes