(LAMP) prevents the client browser from displaying PHP code errors and saves the error message to the log file:
Locate the php.ini in the PHP configuration file (as in the/etc/php.ini under Centos6.7), set
Display_errors = off//does not allow error messages to be displayed in the browser
Log_errors = on//Enter the error information into the log file
Error_log =/var/www/html/php_errors_log//Specifies the error log location
Locate the Apache configuration file http.conf (for example,/etc/httpd/conf/httpd.conf under Centos6.7), set
Php_flag display_errors off
Php_value error_reporting 2039
Restart Apache Server
Service httpd Restart
Note:
1, if the log_errors specified directory exists or does not have permissions, the error will be output to the browser
2. The CentOS user who writes the error log to the Log_errors file is Apache (not the Apache server, but a user of CentOS), so be aware of the Apache user's permissions
Input PHP errors into the log file