The first method: Change the values of display_errors and error_reporting in the php.ini file. If not, add directly (recommended learning: PHP Programming From entry to proficiency)
; 第一处修改 ; display_errors = Off display_errors = On ; 第二处修改 ; error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT error_reporting = E_ALL | E_STRICT
display_errors
Error echo is commonly used in development mode, but many applications forget to turn off this in the formal environment. options. Error echo can expose a lot of sensitive information, which facilitates the attacker's next attack. It is recommended to turn this option off.
display_errors = On
When in the on state, if an error occurs, an error will be reported and an error message will appear
dispaly_errors = Off
In the closed state, if an error occurs, it will prompt: Server error. But no error message will appear
The parameters that error_reporting can set are as follows:
Error reporting is a bit field. You can add up the numbers to get the desired level of error reporting.
E_ALL – All errors and warnings (excluding E_STRICT)
E_ERROR – Fatal runtime errors
E_WARNING – Runtime warnings (non-fatal errors)
E_PARSE – Compile-time parsing error
E_NOTICE – Run-time reminder (These are often caused by bugs in your code, or may be caused by intentional behavior.)
E_STRICT – Encoding standardization warning, allowing PHP to recommend how to modify the code to ensure optimal interoperability and forward compatibility.
E_CORE_ERROR - Fatal error during PHP startup initialization
E_CORE_WARNING - Warning (non-fatal error) during PHP startup initialization
E_COMPILE_ERROR - Fatal at compile time Sexual error
E_COMPILE_WARNING – compile-time warning (non-fatal error)
E_USER_ERROR – user-defined error message
E_USER_WARNING – user-defined warning message
E_USER_NOTICE – User-defined reminder message
Second method: Add the following two sentences in Apache’s httpd.conf file
php_flag display_errors on php_value error_reporting 2039
The above is the detailed content of php enable error prompt. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 Chinese version
Chinese version, very easy to use

Dreamweaver CS6
Visual web development tools

Notepad++7.3.1
Easy-to-use and free code editor

WebStorm Mac version
Useful JavaScript development tools
