Home > Backend Development > PHP Problem > How to set error prompts in php.ini

How to set error prompts in php.ini

藏色散人
Release: 2023-03-13 16:56:02
Original
2414 people have browsed it

How to set error prompts in php.ini: 1. Find and open the php.ini file; 2. Find "display_errors = On" and change it to "display_errors = off".

How to set error prompts in php.ini

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

How to proceed with php.ini Error prompt settings?

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 modification With the permissions of 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);
Copy after login

Of course, if you can modify php.ini, it will be as follows:

The code is as follows

找到display_errors = On 修改为 display_errors = off
Copy after login

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

Solution to the failure of display_errors = Off in PHP .ini

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

3. Search the following line

The code is as follows

error_reporting = E_ALL & ~E_NOTICE
Copy after login

Or search:

error_reporting = E_ALL & ~E_DEPRECATED
Copy after login

Change to

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:/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

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to set error prompts in php.ini. 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