Home>Article>Backend Development> How to configure the php.ini error log path

How to configure the php.ini error log path

青灯夜游
青灯夜游 Original
2022-08-11 17:59:13 2413browse

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.

How to configure the php.ini error log path

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

How to configure the php.ini error log path

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".

How to configure the php.ini error log path

# 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.

How to configure the php.ini error log path

How to configure the php.ini error log path

Step 4. Restart apache

Save the changes and restart apache.

How to configure the php.ini error log path

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn