Home > Backend Development > PHP Tutorial > Turn on and off error prompts in php_PHP tutorial

Turn on and off error prompts in php_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 10:49:49
Original
911 people have browsed it

There are several ways to turn on and off error prompts in php. One can directly use the relevant functions in the program to open an account. The other is that we can use the configuration parameters in php.ini to control it. The following editor will give you Let me introduce it to my classmates.

Windows system switch php error message

If you do not have the permission to modify php.ini, you can add the following code to the php file:

The code is as follows
 代码如下 复制代码

ini_set("display_errors", "On");

error_reporting(E_ALL | E_STRICT);

Copy code

 代码如下 复制代码

找到display_errors = On 修改为 display_errors = off

注意:如果你已经把PHP.ini文件复制到windows目录下,那么必须同时把c:windows/php.ini里的display_errors = On 修改为display_errors = off

PHP .ini中display_errors = Off失效的解决

ini_set("display_errors", "On");


error_reporting(E_ALL | E_STRICT);

Of course, if you can modify php.ini, as follows:

Take my ubuntu as an example, this file is in the /etc/php5/apache2 directory.
The code is as follows Copy code

 代码如下 复制代码
display_errors = Off
Find display_errors = On and change it to display_errors = off

Note: If you have copied the PHP.ini file to the windows directory, you must also change display_errors = On in c:windows/php.ini to display_errors = off
 代码如下 复制代码
error_reporting = E_ALL & ~E_NOTICE
或者搜索:
error_reporting = E_ALL & ~E_DEPRECATED
修改为
error_reporting = E_ALL | E_STRICT

Solution to the failure of display_errors = Off in PHP .ini


 代码如下 复制代码

php_flag display_errors        on
php_value error_reporting       2039

The method of turning on and off error prompts in Linux system is similar, but I will introduce it to you in detail

Linux system

 代码如下 复制代码
sudo /etc/init.d/apache2 restart
1. Open the php.ini file.
2. Search and modify the following line, change the Off value to On 3. Search down
The code is as follows Copy code
error_reporting = E_ALL & ~E_NOTICE Or search: error_reporting = E_ALL & ~E_DEPRECATED Modify to error_reporting = E_ALL | E_STRICT 4. Modify Apache’s httpd.conf, Take my Ubuntu as an example. This file is in the /etc/apache2/ directory. This is a blank file. Add the following two lines:
The code is as follows Copy code
php_flag display_errors on php_value error_reporting 2039 5. Restart Apache and it will be OK. Restart command: :
The code is as follows Copy code
sudo /etc/init.d/apache2 restart

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632675.htmlTechArticleThere are several ways to turn on and off error prompts in php. One can use the relevant functions directly in the program. Open an account, another way we can use the configuration parameters in php.ini to control, the following small...
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template