2

I currently have environment variables in my config.php file to deal with databases but on the last couple of project I've had to turn on debug on more than one occasion. I added $config['debug'] = "1"; to my db environment variables in config.php but it doesn't seem to work as I had expected (i.e. switching debug = 0 to 1 in index.php, which does work by the way). I would love to have debug turned on for all my development and staging environments but off for the live site. Any suggestions? Should I comment out the debug in index.php? Any other areas that might overwrite this variable in config.php?

Current Environment variables for the database and debug values:

/* Environmental Variables
-------------------------------------------------------------------*/
switch ( $_SERVER['HTTP_HOST'] ) {

    // local
    case 'site.dev' :
    $db['expressionengine']['hostname'] = "";
    $db['expressionengine']['username'] = "";
    $db['expressionengine']['password'] = "";
    $db['expressionengine']['database'] = "";
    $config['debug'] = "1";
    break;

    //staging
    case 'staging.site.dev' :
    $db['expressionengine']['hostname'] = "";
    $db['expressionengine']['username'] = "";
    $db['expressionengine']['password'] = "";
    $db['expressionengine']['database'] = "";
    $config['debug'] = "1";
    break;

    // production
    case 'site.com' :
    $db['expressionengine']['hostname'] = "";
    $db['expressionengine']['username'] = "";
    $db['expressionengine']['password'] = "";
    $db['expressionengine']['database'] = "";
    $config['debug'] = "0";
    break;
}
2

If you are going to set it in config.php (instead of index.php or admin.php), you have to set it to 2 instead of 1.

$config['debug'] = 2;
| improve this answer | |
  • Really? Wouldn't 2 show errors to everyone and not just superadmins who are logged in and working on the site? – Stuart McCoy Nov 26 '13 at 19:19
  • Yes it would, but this is on your local site, right? Unfortunately from looking at Core.php it looks like it only enables debugging when the config flag is set to 2. Doesn't look like it checks for 1. – Rob Sanchez Nov 26 '13 at 19:57
  • I'll give both a shot then, see what happens. – Stuart McCoy Nov 27 '13 at 18:10
0

I'd guess it's being overwritten later down in your config file... Remove that instance & the setting should work.

| improve this answer | |
  • That's what I'm guessing too. I'll take a look at it tonight and see if I can sort it out. – Stuart McCoy Nov 26 '13 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.