Quick tip: Debugging CakePHP on a live site
Wednesday, July 22nd, 2009 | CakePHP, Coding, Tips & Tricks | tiaan
As all web developers know, you don’t want site visitors to ever see your sql queries or any debugging information. So wat do you do when you need to debug on a high traffic live site?
The answer:
In your APP/config/core.php file where you set the debugging level, replace the debug level indicator with a short if statement.
Before:
Configure::write('debug', 2);
After:
Configure::write('debug', ($_GET['unguessable_var']) ? ‘2′ : ‘0′);
This allows you to quickly set the debugging level to 2 on any url:
http://www.mycakesite.com/pages/index/?unguessable_var=true
Warning!!!:
Although this can be a great timesaver, you should remember that a unguessable_var is never really unguessable so I wouldn’t recommend leaving your core.php file like this permanently.
No comments yet.
Leave a comment
Categories
Search
Links
Blogroll
News
Podcasts (Audio)
Podcasts (Video)
Science