PHP Exception Report settings do not take effect

Source: Internet
Author: User
PHP Error Reporting settings do not take effect?
In the case of this problem, the (MAX os,php5.4.24) is installed on the machine, the error report is opened in the configuration file (display_errors = on; and error_reporting = E_all & ~e_notices), But now I want to close the bug report in the program,
Ini_set (' Display_errors ', 0);
error_reporting (0);

Why doesn't it take effect? Even if the above two functions are used, a fatal error has been reported. Is there no way to block it? Be sure to modify the configuration file to off?
So I read the manual. There is really a word:
Note:
Although Display_errors can also be set at run time (using Ini_set ()), any runtime settings are not valid when a fatal error occurs on the script. Because the operation that is expected to run is not performed in this scenario.

How does that talk? Is it just that you have a fatal error in your program and that any ini_set is invalid? Then the error report is displayed, complete the INI configuration. So it's impossible to change the report temporarily? Only by modifying the configuration and then restarting the service ....


Ask the great God to explain.



------Solution--------------------
If your error appears in Ini_set (' Display_errors ', 0); Before
Then the error message must be output.
and fatal errors are grammatical errors, which are bound to occur before running

You can direct the error message to the log file
You can also use different php.ini for the development environment and the operating environment
------Solution--------------------
Ini_set (' display_errors ', ' off ');
error_reporting (0);

Put it at the top of the page and try it out.
------Solution--------------------
Display_errors is the meaning of the error display
You shut it down, how can the error be displayed?
Redirecting the error message to the file does not mean that the display_errors can be turned off, only the output device is changed

There are some errors to be encountered at runtime, such as the function is missing parameters, the divisor is 0 ...
------Solution--------------------
This post was last edited by xuzuning on 2014-08-01 17:03:57

Don't do this useless thing.
1, if the error display is turned off, then the error in the parsing phase will directly lead to HTTP 500 wrong
So at least you need to turn on the error display and redirect to the error log
2. All errors generated during operation can be redirected to a custom error handler via the Set_error_handler function
In a custom error handler, you can implement the desired action as you wish.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.