Home  >  Article  >  Backend Development  >  How to enable error reporting in php

How to enable error reporting in php

青灯夜游
青灯夜游Original
2021-03-25 18:39:026640browse

ph method to enable error prompts: 1. Find and open the configuration file "php.ini" in the PHP installation directory; 2. Find the "display_errors=" item in the file and set its value to "On "; 3. Save the file and restart the apache service.

How to enable error reporting in php

The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

In the process of development, It is best to turn on the error message. For some errors, if you do not turn on the error prompt, the error prompt may not appear. This will not achieve technical rigor.

Let’s turn on the error message of PHP

1. Find and open the configuration file php.ini in the PHP installation directory

## 2 , search in the file,

display_errors=

On means the error prompt is on

display_errors=On

Off means the error prompt is off

display_errors=Off

Example demonstration, defining an incorrect PHP syntax

When previewing in the browser, it cannot print correctly, but no error is reported,

Because the current

display_errors=Off, the error prompt is not turned on

Turn on the PHP error prompt, set:

display_errors=On

And save the new settings of the file

Note: After saving the settings, restart the apache service again

Run the file just now

Now the PHP error prompt has been successfully turned on, and error messages can be reported normally

Recommended study: "

PHP Video Tutorial"

The above is the detailed content of How to enable error reporting in php. 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