Organizational Research By

Surprising Reserch Topic

How to turn off mysql errors from being displayed to screen in CodeIgniter

Even though error_reporting is set to 0, database errors are still being printed to screen. Is there a setting somewhere I can change to disable database error reporting? This is for CodeIgniter v1.6.x

EDIT: Re: Fixing errors - Um, yes. I want to fix the errors. I get error notices from my error log, not from what my visitors see printed to their screen. That helps no one, and hurts my system's security.

EDIT 2: Setting error_reporting to 0 does not affect CodeIgniter's built-in error logging class from writing to the error log.

asked Jun 1, 2015 in codeinither by rajesh
0 votes

Related Hot Questions

2 Answers

0 votes

Found the answer:

In config/database.php:

// ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.


$db['default']['db_debug'] = FALSE;

... should disable.

answered Jun 1, 2015 by rajesh
0 votes

In addition to Ian's answer, to temporarily disable the error messages:

$db_debug = $this->db->db_debug;
$this->db->db_debug = false;

// Do your sketchy stuff here

$this->db->db_debug = $db_debug;


answered Jun 1, 2015 by rajesh