Home > Backend Development > PHP Tutorial > How to open PHP error reporting

How to open PHP error reporting

WBOY
Release: 2016-07-25 08:51:25
Original
1442 people have browsed it
There are two configuration variables that you should be aware of when debugging PHP applications. Here are the two variables and their default values: display_errors = Off error_reporting = E_ALL

How to open PHP error report for your reference.

There are many configuration settings in the php.ini file. You should have already set up your php.ini file and placed it in the appropriate directory, as shown in the documentation for installing PHP and Apache 2 on Linux. There are two configuration variables that you should be aware of when debugging PHP applications. Here are the two variables and their default values: display_errors = Off error_reporting = E_ALL

The current default values ​​of these two variables can be discovered by searching for them in the php.ini file. The purpose of the display_errors variable is obvious - it tells PHP whether to display errors. The default value is Off. However, to make the development process easier, set this value to On: display_errors = On

The default value of error_reporting variable is E_ALL. This setting will show everything from bad coding practices to harmless tips to errors. E_ALL is a bit too fine-grained for development because it also displays hints on the screen for small things (such as variables not being initialized), which messes up the browser's output. I only want to see errors and bad coding practices, but not harmless tips. So, please replace the default value of error_reporting with the following value: error_reporting = E_ALL & ~E_NOTICE

Restart Apache and the configuration is complete.



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