How to configure Codeigniter to report all errors? How to configure Codeigniter to report all errors? codeigniter codeigniter

How to configure Codeigniter to report all errors?


It depends on your version of CI. For < 2.x edit the top level index.php and adjust the error_reporting function to use E_ALL"

error_reporting(E_ALL);

For >= 2.x edit the top level index.php and make sure ENVIRONMENT is set as:

define('ENVIRONMENT', 'development');

which sets the error_reporting to E_ALL.


Create a .htaccess file in your webroot with the following content

php_flag display_startup_errors onphp_flag display_errors onphp_flag html_errors onphp_flag log_errors onphp_flag ignore_repeated_errors offphp_flag ignore_repeated_source offphp_flag report_memleaks onphp_flag track_errors onphp_value error_reporting -1php_value log_errors_max_len 0

Hopefully that should enable your logs.
Make sure to set the values to off and reporting to 0 on your production server :)


Following environment settings would gonna force PHP to display errors as they occur:

  • APPLICATION ENVIRONMENTdefine('ENVIRONMENT', 'development');/*
  • ERROR REPORTING

    if (defined('ENVIRONMENT')){ switch (ENVIRONMENT) { case 'development': // Report all errors error_reporting(E_ALL);

            // Display errors in output        ini_set('display_errors', 1);        break;    case 'testing':    case 'production':        // Report all errors except E_NOTICE        // This is the default value set in php.ini        error_reporting(E_ALL ^ E_NOTICE);        // Don't display errors (they can still be logged)        ini_set('display_errors', 0);    break;    default:        exit('The application environment is not set correctly.');}

    }