Selectively turning on debug mode.
Posted: Mon Nov 15, 2010 7:25 pm
There are many times that I want to turn on debug mode, but don't want users to see the info when they go to my site. I just had this idea and made the following changes to my config.php file.
Replace:
with:
Now, when you go to your site, add '?debug=1' to the URL or '&debug=1' if you already have parameters.
You might not want to leave it this way, since it might give hackers extra information about your site if they stumble upon the debug option, but you can put it in whenever you need debug information, but don't want the site's users to see it.
Replace:
Code: Select all
$config['debug'] = false;
Code: Select all
if ($_GET['debug']) {
$config['debug'] = true;
} else {
$config['debug'] = false;
}
You might not want to leave it this way, since it might give hackers extra information about your site if they stumble upon the debug option, but you can put it in whenever you need debug information, but don't want the site's users to see it.