php shows error

王林
王林Original
2019-09-29 11:55:144523browse

php shows error

1. Windows system switch php error message

If you do not have the permission to modify php.ini, you can add the following code to the php file :

ini_set("display_errors", "On");
error_reporting(E_ALL | E_STRICT);

Of course, if you can modify php.ini, 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 display_errors = On in c:windows/php.ini to display_errors = off

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 the Linux system

## 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

display_errors = Off

3. Search for the following line

error_reporting = E_ALL & ~E_NOTICE

or Search:


error_reporting = E_ALL & ~E_DEPRECATED

Change to:


error_reporting = E_ALL | E_STRICT

4. Modify Apache’s httpd.conf

to my Ubuntu For example, this file is in the /etc/apache2/ directory. This is a blank file. Add the following two lines:

5. Restart Apache and it will be OK.

php_flag display_errors        on
php_value error_reporting       2039

Restart command:

sudo /etc/init.d/apache2 restart

Recommended tutorial:

PHP video tutorial

The above is the detailed content of php shows error. For more information, please follow other related articles on the PHP Chinese website!

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

Related articles

See more