Home > Article > Backend Development > How to configure the php.ini error log path
Configuration steps: 1. Find and open the "php.ini" configuration file; 2. In the "php.ini" configuration file, search for the "log_errors" parameter item and change the value of the parameter item from "Off "Modify it to "On"; 3. In the "php.ini" configuration file, search for the "error_log" parameter item, and set the value of this parameter item to the error log path, with the syntax "error_log = "absolute path/file name.log" ""; 4. Save the changes and restart apache.
The operating environment of this tutorial: windows7 system, PHP8.1 version, DELL G3 computer
In the production environment, if it cannot be displayed on the page When I see error output, how do I find the error and debug page?
In the code, you can use the error_reporting function to control error output. Of course, you can also find errors through the error log.
So how to configure the PHP error log path? Let’s introduce it below.
Step 1: Find and open the php.ini configuration file
Step 2: Turn on the error log
In the php.ini configuration file, search for the "log_errors" parameter item and change the value of the parameter item from "Off" to "On".
# The log_errors parameter is used to set whether to keep error logs on the server.
Step 3: Set the error log path
In the php.ini configuration file, search for the "error_log" parameter item and set the value of the parameter item It can be the error log path.
error_log is used to control the location of the log file. You can configure error_log as an absolute path, so that you can see the relevant page error information at the corresponding location.
Step 4. Restart apache
Save the changes and restart apache.
Recommended study: "PHP Video Tutorial"
The above is the detailed content of How to configure the php.ini error log path. For more information, please follow other related articles on the PHP Chinese website!