Selectively turning on debug mode.

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Selectively turning on debug mode.

Post by Wishbone »

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:

Code: Select all

$config['debug'] = false;
with:

Code: Select all

if ($_GET['debug']) {
  $config['debug'] = true;
} else {
  $config['debug'] = false;
}
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.
gully
Forum Members
Forum Members
Posts: 27
Joined: Sun Oct 17, 2010 11:43 am

Re: Selectively turning on debug mode.

Post by gully »

This is nice.

Anyone know of an implementation of writing to file, instead of to screen?
Post Reply

Return to “Tips and Tricks”