webhost

Web hosting

Thursday, February 16, 2012

codeigniter error reporting handling


1. Turn off PHP Errors with error_reporting(0)In the root directory of your CodeIgniter installthere is an index.php fileThe first option in there is ‘PHP ERROR REPORTING LEVEL’.

 Set it to zero:error_reporting(0);CodeIgniter version 2.0.1 and above have an environment constant in the index.php file as wellSetting this to “production” will disable all PHP error outputRead more about this on the Codeigniter User Guide page on Security and on Handling Environments. 

2. Turn off Database Errors in Config
The PHP errors are off
but any MySQL errors are still going to showTurn these off in the /config/database.php fileSet the db_debug option to false: 

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

3. Adjust Error Logging Threshold
The 
/config/config.php file has a log threshold optionIt states “For a live site you’ll usually only enable Errors (1to be logged otherwise your log files will fill up very fast.

$config
['log_threshold'] = 1; 


4. Turn on all Errors in Config
In the root directory of your CodeIgniter install
there is an index.php fileThe first option in there is ‘PHP ERROR REPORTING LEVEL’Set it to :
    
error_reporting(E_ALL);

No comments:

Post a Comment