Home >Backend Development >PHP Problem >What to do if ubuntu php turns off the warning
Ubuntu php shutdown warning solution: 1. Open the php configuration file php.ini; 2. Change "display_errors=Off" to "display_errors=On"; 3. Modify Apache's httpd.conf; 4 , restart Apache.
The operating environment of this article: Ubuntu 14.04 system, PHP5 version, DELL G3 computer
What should I do if ubuntu php closes the warning?
In Ubuntu 14.04, the default PHP development environment configuration does not prompt all warning and error messages. This is very painful for developers. Record the configuration method here for future convenience. The editor has also found 2 types. The first one is very simple, but the steps span a long time. The second type has extremely detailed steps. Everyone can take it away.
Lite version steps:
1. Modify the php configuration file php.ini
The code is as follows:
sudo gedit /etc/php5/apache2/php.ini
Change display_errors = Off to display_errors = On
Change error_reporting = xxx to error_reporting = E_ALL | E_STRICT
2. Restart apache
The code is as follows:
sudo /etc/init.d/apache2 restart
OK! Enjoy!
Detailed steps
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
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:
The code is as follows:
error_reporting = E_ALL & ~E_DEPRECATED
is modified to
The code is as follows:
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:
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
ok! The error message is successfully enabled!
The above is an introduction to how to enable PHP error prompts under Ubuntu. If you encounter an error without prompting when editing PHP, then you can configure it according to the method introduced in this article.
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What to do if ubuntu php turns off the warning. For more information, please follow other related articles on the PHP Chinese website!