Can't disable error reporting in OpenCart (PHP)

后端 未结 6 2201
失恋的感觉
失恋的感觉 2021-02-10 11:54

I can\'t seem to disable error reporting in PHP - I have tried everything but \"Notice\" errors are still displayed.

My php.ini has

display_errors = Off;         


        
相关标签:
6条回答
  • 2021-02-10 12:15

    There is a setting within the OpenCart dashboard that allows you to turn on (or off) error reporting and logging.

    1. Log into your dashboard
    2. In the menu, go to "System" and select "Settings"
    3. In the list of stores, click "Edit" for your store
    4. Click the "Server" tab.
    5. Scroll down, and there's two settings:
      a. Log Errors - set this as desired
      b. Display Errors - set this to "No"
    0 讨论(0)
  • 2021-02-10 12:19

    OpenCart uses the set_error_handler() function which causes it to override the error_reporting(0).

    Removing this fixed my problem.

    0 讨论(0)
  • 2021-02-10 12:22

    As @colmde already pointed OpenCart uses custom error_handler.

    You can turn error displaying off without any code edits (especially OpenCart core files) via:

    Admin->System->Settings->[edit your configured store]->Server->Display Errors

    [EDIT] You can do the same by running following query against OpenCart database:

    update setting set `value`= 1 where `key` = 'config_error_display'
    
    0 讨论(0)
  • 2021-02-10 12:22

    you can simply use

    ini_set('display_errors', 0);
    

    on system/startup.php

    0 讨论(0)
  • 2021-02-10 12:30

    True way in OpenCart.

     $this->config->set('config_error_display', 0);
     $this->processAction(); // it throws ugly warning
    

    I've tested in the controller of my module. Just to turn off showing errors before your code. It affects only current session (perhaps even current page). It doesn't affect the DB!

    0 讨论(0)
  • 2021-02-10 12:37

    for me helped: //error_reporting(E_ALL);

    in file startup.php

    0 讨论(0)
提交回复
热议问题