Chris Nizzardini, Salt Lake City Utah, Web Developer Specializing in LAMP+Ajax Since 2006

My Blog

Here is my awesome blog. You can find information on programming, linux, documentation, tips for code and database optimization, my thoughts and rants, and whatever else I feel like sharing. Feel free to contribute to the blog by posting comments and asking questions.
Programming

using firephp to debug php web applications

FirePHP enables you to log to your Firebug Console using a simple PHP method call. All data is sent via response headers and will not interfere with the content on your page. FirePHP is ideally suited for AJAX development where clean JSON and XML responses are required. Using FirePHP on a production server is a safe and easy way to debug an application without inconveniencing end-users. FirePHP requires PHP 5 on the server, firebug on the client with all three options settings including Net enabled for the site. It can be installed via PEAR or by uploading two classes to your server and referencing them via the include_once() method.

Once the files are uploaded to the server, include them in your script, instantiate the FirePHP class as an object, and call the log() method by passing in two parameters the variable and a title.

1
2
3
include_once('FirePHPCore/FirePHP.class.php');
$firephp = new FirePHP();
$firephp->log($variable,'Enter an optional title for the second parameter');

When you pass an array as a variable to firebug it will display it in a human readable format similar to placing print_r() in between the pre html tags. The most notable security risk to using FirePHP is that anyone with the firephp extension enabled can you use it to see any information you are dumping to the client. My advice is to immediately comment out firebug logging calls once you are finished debugging the application, especially if you are dumping out raw SQL syntax to the client.

Related posts:

  1. Planning and Analysis for your Next Web Development Project

Leave a Reply