Home >Backend Development >PHP Problem >How to turn off error reporting in php

How to turn off error reporting in php

青灯夜游
青灯夜游Original
2021-03-19 12:01:572742browse

How to turn off error reporting in php: 1. Open the configuration file "php.ini" and change the value of the "display_errors" option to "off". 2. Add the "error_reporting(E_ALL^E_NOTICE^E_WARNING);" code to the php file.

How to turn off error reporting in php

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

php close error report

Method 1: Modify the PHP configuration file php.ini

First open the configuration file php.ini

and then search for ' display_errors', change display_errors = On to display_errors = off. (Off means to close the error prompt, On to open the error prompt)

Note: If you have copied the PHP.ini file to the windows directory, you must also copy it to c:windows/php.ini The display_errors = On is modified to display_errors = off

Method 2: Use the error_reporting() function

in the php file Add the following code

error_reporting(E_ALL^E_NOTICE^E_WARNING);

to turn off all notice and warning level errors.

Put this statement in the function include file of your script, usually config.php or conn.php to control the output.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to turn off 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