Home >Backend Development >PHP Problem >php shows error
1. 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 :
ini_set("display_errors", "On"); error_reporting(E_ALL | E_STRICT);
Of course, if you can modify php.ini, as follows:
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
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/apache2 directory.2. Search and modify the following line, change the Off value to On
display_errors = Off
3. Search for the following line
error_reporting = E_ALL & ~E_NOTICEor Search:
error_reporting = E_ALL & ~E_DEPRECATEDChange to:
error_reporting = E_ALL | E_STRICT
4. Modify Apache’s httpd.conf
to my Ubuntu For example, this file is in the /etc/apache2/ directory. This is a blank file. Add the following two lines:5. Restart Apache and it will be OK.
php_flag display_errors on php_value error_reporting 2039
Restart command:
sudo /etc/init.d/apache2 restartRecommended tutorial:
The above is the detailed content of php shows error. For more information, please follow other related articles on the PHP Chinese website!