Get the App
SLTechnology News&Howtos  ›  Development  › 

How to turn the error message on and off for php

Shulou Source: shulou.com Published: 2022-06-03 18:26:04 09月27日 Update

This article mainly explains "how to turn on and off error prompts for php". Friends who are interested may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to turn on and off error tips for php".

Windows system switch php error message

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 change it to display_errors = off

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

The solution to the failure of display_errors = Off in PHP .ini

The method of turning on and off the error prompt in linux system is similar, but I will introduce it to you in detail.

Under the linux system

1. Open the php.ini file.

Take my ubuntu as an example, this file is in the: / etc/php5/a (www.jb51.net) pache2 directory.

two。 Search and modify the following line to change the off value to On

The code is as follows

Display_errors = Off

3. Search for downlink

The code is as follows

Error_reporting = E_ALL & ~ E_NOTICE

Or search for:

Error_reporting = E_ALL & ~ E_DEPRECATED

Modify to

Error_reporting = E_ALL | E_STRICT

4. Modify the httpd.conf of Apache

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 you will OK.

Restart command:

The code is as follows

Sudo / etc/init.d/apache2 restart

At this point, I believe you have a deeper understanding of "how to turn on and off the error prompt of php". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Code files errors prompts directories systems searches content methods learning practical deeper almost interest at the same time commands practicality practicality simple operation more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Huawei Xiaomi Microsoft Redmi