Debugging Your Application

It's difficult to debug PHP applications; while there are excellent PHP-level debugging mechanisms such as XDebug, it is often hard to integrate these into your environment - perhaps, you are working on a shared host? Maybe you don't have root access to your server? In that case, many PHP developers resort to using methods such as

exit ("Processed fine up to here; variable value = " . $myVar);

We all know that these methods are rather limiting - in particular, when you are trying to debug advanced AJAX applications, such as QCubed apps. That's why we've included a better mechanism for debugging through Firebug:

"QFirebug Debugging Output"

Here's how to make it work:
Install the following prerequisites in the order specified below:

  • Firefox
  • Firebug (Powerful Firefox extension for debugging)
  • FirePHP (Firebug extension for PHP debugging)

Then, come back to this page and open and enable the Firebug console by going to Tools | Firebug | Enable Firebug in the Firefox menu. Make sure that the Console, Script, and Net panels are enabled in Firebug.

You can then use the QFirebug static class to output your debugging messages to the Firebug console. You can expect the standard log() methods - review the effects by clicking Button A below. It's also really easy to output the queries (database profile) into the console by using QFirebug::OutputDatabaseProfile(). Remember that you need to first enable the profiling for your database for it to work - see this in action by clicking Button B below.

   

Open the Firebug console, and then click one of the buttons above