Home > Backend Development > PHP Problem > php shows error

php shows error

王林
Release: 2023-02-25 15:20:01
Original
4524 people have browsed it

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

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

3. Search for the following line

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

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

Restart command:

sudo /etc/init.d/apache2 restart
Copy after login
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!

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