Get the App
SLTechnology News&Howtos  ›  Development  › 

How does PHP turn on the error message?

Shulou Source: shulou.com Published: 2022-06-01 12:31:59 10月12日 Update

Most people do not understand the knowledge points of this article "PHP how to open error tips", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can gain something after reading this article. Let's take a look at this "PHP how to open error tips" article.

Add directly to the PHP code:

Ini_set ("display_errors", "On"); / / Open the error prompt ini_set ("error_reporting", E_ALL); / / Show all errors

You can turn on the error message.

Error_reporting error level:

E_ALL-all errors and warnings (including E_STRICT in PHP 5.4.0) E_ERROR-fatal run-time errors E_RECOVERABLE_ERROR-near-fatal run-time errors E_WARNING-run-time warnings (non-fatal errors) E_PARSE-compile-time parsing errors E_NOTICE-runtime notifications (these are usually warnings An error from your code, but it may be intentional (for example, using an uninitialized variable and relying on it being automatically initialized to an empty factual string) E_STRICT-runtime notification Allowing PHP to recommend changes to your code will ensure optimal interoperability and forward code compatibility E_CORE_ERROR-fatal errors that occur during PHP initial startup E_CORE_WARNING-PHP warnings (non-fatal errors) Initial startup of E_COMPILE_ERROR-fatal compile-time error E_COMPILE_WARNING-compile-time warning (non-fatal error) E_USER_ERROR-user-generated error message E_USER_WARNING-user-generated warning message E_USER_NOTICE-user-generated notification message E_DEPRECATED-warning code does not work in future versions of PHP USER_DEPRECATED-user-generated deprecation warning

Some of the most common settings for error_reporting:

E_ALL (displays all errors, warnings and notifications, including coding standards. ) E_ALL & ~ E_NOTICE (displays all errors except notifications) E_ALL & ~ E_NOTICE & ~ E_STRICT displays all errors except notifications and coding standard warnings. ) E_COMPILE_ERROR | E_RECOVERABLE_ERROR | E_ERROR | E_CORE_ERROR (only errors are displayed)

In the development environment, you can modify the php.ini file and set display_errors = On to turn on the error message.

Error_reporting = E_ALL; display all errors display_errors = Off; turn off error prompt log_errors = On; enable error log log_errors_max_len = 1024; set maximum log length error_log = / usr/local/error.log The above location of the error log file is about the content of this article on "how to open error tips for PHP". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more related knowledge, please pay attention to the industry information channel.

Tags: Error hint code content run user generate log message compile file article standard knowledge article code maximum fact value location Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS MariaDB NVidia vpn Linux