How to enable error reporting in php

青灯夜游
Release: 2023-03-09 06:24:01
Original
6614 people have browsed it

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
Copy after login

Off means the error prompt is off

display_errors=Off
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!