Skip to content
Advertisement

How to Setup and use FirePHP with FireFox Developer

I am an old school programmer so I am having issues trying to install and use some of the newer programming tools. I am building a website using php but need some suggestions on the best debugging tools that are available for PHP. I am using Visual Studio and FireFox Developer browser for this but I am new to using both of these. I am asking for someone to please assist me in setting up FirePHP in FireFox Developer. I have installed the FirePHP extension in FireFox Developer but when I click on the debugging tools tab I get a window that says I need a server library. I put the FirePHP.class.php core file on the server and included the path to this in my php code. I still cant get this to work. If someone can step me through this so I can use these newer tools I would be so happy. Like I say, I am an old school programmer so I dont know how alot of these new tools work. Thanks

Advertisement

Answer

FirePHP consists of a server-side and a client-side component.

PHP library (server side)

The server-side component is responsible for sending PHP specific information (via special HTTP headers) to the browser.

For PHP there are two libraries, FirePHPCore and ChromePhp.

FirePHPCore

As far as I saw, there is no proper documentation on how to install it or its usage but the library includes some examples for object oriented and procedural code.

To install it, you just need either the FirePHP.class.php file (for object oriented programming) or the fb.php file (for procedural programming) from the repository. You can then use FirePHPCore like this:

Object oriented:

require('FirePHPCore/FirePHP.class.php');

$firephp = FirePHP::getInstance(true);
$firephp->fb('Log message');
$firephp->fb('Info message', FirePHP::INFO);

Procedural:

require('FirePHPCore/fb.php');

fb('Log message');
fb('Info message', FirePHP::INFO);

ChromePhp

ChromePhp uses the Chrome Logger protocol and can be used like this:

include 'ChromePhp.php';
ChromePhp::log('Hello console!');
ChromePhp::log($_SERVER);
ChromePhp::warn('something went wrong!');

Browser extension (client side)

The browser extension FirePHP is used to display the data coming from the server.

When the extension is installed, you need to grant it permission to intercept the requests of your website.

Grant FirePHP extension permission to intercept requests of specific websites

When the permission is granted, open the Firefox DevTools (e.g. by pressing F12) and switch to the FirePHP panel. You may need to click the Click to Enable button on the right side of the panel.

And when everything’s set up correctly, you’ll see the output within the panel.

FirePHP panel output

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement