Jeremy Harris

This post is very old. Technology, especially open source, moves very fast and it's likely that some of the information could be out of date. Please take that into consideration as you read this post.

Feb 2011

Debugging CakePHP Ajax calls with FirePHP

If you're writing a CakePHP application, one of the first things you should be doing when starting out is downloading DebugKit, the invaluable debugging plugin. If you don't have it, go install it here: https://github.com/cakephp/debug_kit

Most web apps make use of Ajax here and there. And with Cake and jQuery basically doing the work for you, why wouldn't you? Debugging these requests can be a tricky nuisance, though, but that's where the awesomeness of DebugKit comes in. It comes with support for sending debug information to FirePHP, a Firefox extension that works in conjunction with Firebug (if you don't have Firebug, download it)to log Ajax information in real time to your browser.

Installing FirePHP

To use FirePHP, you'll need to download the library. It's a quick download:

http://www.firephp.org/HQ/Install.htm

Extract the zip, take the FirePHPCore folder within the zip's lib folder, and drop it in your app's vendors folder.

Lastly, you'll need the FirePHPextension for Firefox. After downloading it and restarting Firefox, you'll need to enable the Net panel in Firebug if you haven't already. Pop open Firebug, go to the Net tab and enable it.

That's it

When your app performs an Ajax call, you'll now see all of the lovely information DebugKit has to share in your Firebug console, specific to that request.

Jeremy Harris is a web developer with over 10 years of experience. He's coded in many languages and currently focuses on PHP, both agnostic and framework-based. When he isn't at the keyboard, you can find him walking @riverthepuppy or brewing beer. He only talks in the third person when peer pressure dictates he should, such as on his blog.