Turn on/off error reporting

7 posts by 3 authors in: Forums > CMS Builder
Last Post: January 20, 2014   (RSS)

By gversion - January 8, 2014

Hello,

I have seen that there is a setting in /cmsAdmin/lib/init.php as follows:

  ini_set('display_errors', '1');         //

Is there a setting in the Admin area to turn off display_errors? Or do I need to manually edit the init.php file as follows:

  ini_set('display_errors', '0');         //

Thank you for your help.

Regards,

Greg

Hi Dave,

Thanks for the tip. A plugin sounds like a great idea! Is there a plugin you can suggest that I could use as a starting point?

Regards,

Greg

By Dave - January 17, 2014

Hi Greg, 

Try this: 

<?php
/*
Plugin Name: Disable Error Reporting
Plugin Description: Disable PHP's error reporting features.
Required System Plugin: Yes
*/

addAction('init_complete', 'disableErrorReporting', null, 0);

//
function disableErrorReporting(){
  error_reporting(-1);
  ini_set('display_errors', '0');
  ini_set('display_startup_errors', '0');
}

?>

Let me know if that works for you.

Dave Edis - Senior Developer
interactivetools.com

By jenolan - January 17, 2014

I think you need to remove

Required System Plugin: Yes

So that the plugin can be enabled/disabled as required

---



Peace and Long Life

Hi Dave,

Thank you for the suggested plugin, I think that will work great. I will be in touch again if there are any problems.

Regards,

Greg

By Dave - January 20, 2014

Larry, good point.  

If anyone using this plugin wants to toggle it on and off (such as for debugging purposes) then you'll want to remove the Required System Plugin line.

But if you want it on all the time and want to prevent it from being turned off (such as on a live server where you don't want debug error output) then leave it there.

This applies to any other plugins as well.  If a plugin is critical to the sites operation and you want to make sure it can't be accidentally disabled you can always just add this line to the top:

Required System Plugin: Yes

Hope that helps! Cheers!

Dave Edis - Senior Developer
interactivetools.com