Home > Article > Backend Development > How to set error message in php.ini
In PHP, you can use "display_errors" in the "php.ini" file to set error prompt information. When "display_errors" is set to "On", it means that the display of error prompt information is enabled. When this item When the content is set to "Off", it means that the display of error prompts is turned off.
The operating environment of this article: Windows 10 system, PHP version 7.1, Dell G3 computer
How to set up the error report in the PHP configuration file php.ini
Windows system switch php error prompt
If you do not have the permission to modify php.ini, you can add the following code to php In the file:
The code is as follows
ini_set("display_errors", "On"); error_reporting(E_ALL | E_STRICT);
Of course, if you can modify php.ini, it is as follows:
The code is as follows
找到display_errors = On 修改为 display_errors = off
Note: If You have copied the PHP.ini file to the windows directory, then you must also change display_errors = On in c:windows/php.ini to display_errors = off
Solution to the failure of display_errors = Off in PHP.ini
Extended knowledge:
The method of turning on and off error prompts in the Linux system is similar, but I will introduce it to you in detail
Under the Linux system
1. Open the php.ini file.
Taking my ubuntu as an example, this file is in the /etc/php5/a(www.jb51.net)pache2 directory.
2. Search and modify the following line, change the Off value to On
The code is as follows
display_errors = Off
3. Search the following line
The code is as follows
error_reporting = E_ALL & ~E_NOTICE
Or search:
error_reporting = E_ALL & ~E_DEPRECATED
Change to
error_reporting = E_ALL | E_STRICT
4. Modify Apache’s httpd.conf,
Take my Ubuntu as an example, this file is in:/etc /apache2/ directory, this is a blank file.
Add the following two lines:
The code is as follows
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
sudo /etc/init.d/apache2 restart
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to set error message in php.ini. For more information, please follow other related articles on the PHP Chinese website!