What to do if ubuntu php turns off the warning

藏色散人
Release: 2023-03-14 20:36:02
Original
1198 people have browsed it

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.

What to do if ubuntu php turns off the warning

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
Copy after login

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
Copy after login

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
Copy after login

3. Search the following line

The code is as follows:

error_reporting = E_ALL & ~E_NOTICE
Copy after login

Or search:

The code is as follows:

error_reporting = E_ALL & ~E_DEPRECATED
Copy after login

is modified to

The code is as follows:

error_reporting = E_ALL | E_STRICT
Copy after login

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
Copy after login

5. Restart Apache and it will be OK.

Restart command:

The code is as follows:

:sudo /etc/init.d/apache2 restart
Copy after login

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!

Related labels:
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template