How to turn off error reporting in php

青灯夜游
Release: 2023-03-08 21:00:01
Original
2637 people have browsed it

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

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!

Related labels:
php
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!