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:
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. |
Take my ubuntu as an example, this file is in the /etc/php5/apache2 directory.
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
http://www.bkjia.com/PHPjc/632675.htmlwww.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...
|
|
|
|