Phperror_log error information if we want to analyze logs, We need to generate a log file and save it to the database or file. Here we take the file writing as an example, next let's take a look at the php error_log error information. If we want to analyze the log, We need to generate a log file and save it to the database or file. Here we take the file writing as an example. Next let's take a look at it.
Script ec (2); script
During development, display_errors and error_reporting are basically enabled to improve development efficiency. After going online, the page error is basically closed and the error message is put into the file.
1. php-fpm error_log Configuration
1. Modify php. ini.
Display_errors = Off // Changes to off, so no error message is reported during page access.
2. Modify the php-fpm configuration file.
; Php_flag [display_errors] = off
Php_admin_value [error_log] =/var/log/php-fpm/www-error.log
Php_admin_flag [log_errors] = on
Restart php-fpm. Note that the configuration of php-fpm replaces the configuration in php. ini. display_errors can also be configured in php-fpm. In this way, no error information is reported on the page, and the error information is recorded in the file.
2. Configure error_log in the command line and modify php. ini.
Display_errors = Off
Log_errors = On
Error_log =/var/log/cron/error. log
Run the following command:
[Root @ network www] # php test. php // test. php syntax error
In the command line, php-fpm configuration is not called, so we can only modify the content of php. ini. After modification, php does not need to be restarted. After the command is executed, the error message is written to the error. log file. This is suitable for the php script of crontab.