php on and off error prompts apply to those who do not have permission to modify php. ini

  • 2021-07-22 09:09:57
  • OfStack

windows System Switch php Error Prompt

If you do not have 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);

Of course, if you can modify php. ini, you can do the following:

The code is as follows

Find display_errors = On and modify it to display_errors = off

Note: If you have copied the PHP. ini file to the windows directory, you must also modify display_errors = On to display_errors = off in c: windows/php. ini

Solution of display_errors = Off Failure in PHP. ini

In linux system, the method of opening and closing error prompt is similar, but I still introduce 1 to you in detail

Under linux system

1. Open the php. ini file.

Take my ubuntu as an example. This file is in the directory:/etc/php5/a (www. ofstack. com) pache2.

2. Search and modify the downlink, and change the Off value to On

The code is as follows

display_errors = Off

3. Search Downlink

The code is as follows

error_reporting = E_ALL & ~E_NOTICE

Or search:

error_reporting = E_ALL & ~E_DEPRECATED

Modify to

error_reporting = E_ALL | E_STRICT

4. Modify httpd. conf of Apache,

Take my Ubuntu as an example. This file is in the directory:/etc/apache2/, which 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


Related articles: