Error reporting and debugging in codeigniter

To Turn off Debugging

Set the db_debug value(in the application/config/database.php config file) to false

To Turn off Error reporting

Set the Envirement value(in the top of the main index.php) to production or testing

Replace define(‘ENVIRONMENT’, ‘development’); to define(‘ENVIRONMENT’, ‘production’);

One another way to make all of this easy has been for me to set the db_debug value (in the application/config/database.php config file) to a constant I declare MP_DB_DEBUG. And add the following code to the top of the main index.php to replace the error_reporting() declaration when the site is live (will disable all errors):

ini_set('display_errors', 'Off');
error_reporting(0);
define('MP_DB_DEBUG', false); 
But when in production or testing phase I’d suggest:
ini_set('display_errors', 'On');
error_reporting(-1);
define('MP_DB_DEBUG', true);

Share This Post

Post Comment