FirePHP on Magenting
December 17, 2010

FirePHP can be useful when debugging remote PHP applications on shared or dedicated servers. This tutorial illustrates how to setup FirePHP 1.0 on Magenting which is a managed Magento hosting service.

Account Creation

Go to and create an account. This tutorial was prepared by using a Spark account, but it should work just the same with all plans.

If you already have an account you can of course skip this step.

Install & Download


Install the FirePHP Companion client extension:

Download the FirePHP 1.0 server library

We use the FirePHP zip archive instead of the phar archive as including the phar archive does not seem to work on the Magenting hosting service.


Extract the FirePHP archive and locate the lib folder.

Log into the FTP account for the account created above and go into the /lib folder.

Upload all folders (excluding Zend – already exists on server). This will place all libraries required by FirePHP next to the ones used by Magento.


On the server (via FTP) create a file at /app/etc/package.json with the following content:

  "uid": "",
  "implements": {
    "": {
      "cache": {
        "path": "./../../var/cache"
      "server": {
        "path": "/index.php"
      "paths": {
        "./../../": "allow",
        "./credentials.json": "deny"

NOTE: Make sure to update the uid property to the hostname assigned to you.

Create a second file at /app/etc/credentials.json with the following content:

  "": {
    "allow": {
      "ips": [
      "authkeys": [

NOTE: Make sure to update the your-ip value to your IP which you can get by visiting Keep the your-authkey value until you get your own below.


To include FirePHP on the server replace the /index.php file with the following:

define('INSIGHT_CONFIG_PATH', __DIR__ . '/app/etc/package.json');
require_once(__DIR__ . '/lib/FirePHP/Init.php');
require_once(dirname(__DIR__) . '/codebase/magento-');

NOTE: The Magenting service creates a link at /index.php which we are replacing with a file. At the time of writing the link pointed to ../codebase/magento- You may need to change the version if applicable by looking at the link before replacing it.

Authorize Client

In Firefox, open Firebug, enable the Console, Net and Insight panels and select the Console panel.

Load the Magento store (in my case and look for the Authorization Key logged to the Firebug Console.

Update the your-authkey value in the credentials.json file above to the Authorization Key copied from the Firebug Console.

Test Debug Output

You can now place logging calls using the Insight API anywhere in the application and refresh your browser to see the result. For example you can log all DB queries by adding the following logging statement to /lib/Zend/Db/Adapter/Pdo/Abstract.php (that is on line 237 at the time of writing):

*** 232,239 ****
--- 232,241 ----
                      $bind[$newName] = $value;
+         FirePHP::to('page')->console()->group('db', 'DB Queries')->log($sql);
          try {
              return parent::query($sql, $bind);
          } catch (PDOException $e) {

This tells FirePHP to log the $sql to a group called DB Queries in the Firebug Console. For a complete API reference see here.


If you follow the instructions above you should not have any problems in getting FirePHP working as long as the Magenting service does not make changes to its default structure.

The most common cause of problems are mistakes in the json configuration files. You can ask FirePHP to show these errors by setting the following constant before including FirePHP in /index.php.

define('INSIGHT_DEBUG', true);

Make sure to remove this again when you are done.

If this does not solve the problem the best place to start troubleshooting is by using the Test Tool. To launch go to the Insight panel in Firebug and click on the Test Tool button. Use the Server/Application Test by entering the URL to your store.

The best place to get help if the Test Tool is not helping is here.


This tutorial covered how to setup FirePHP and log a simple message on the Magenting hosting service. FirePHP already has various features to make remote debugging like this useful and there is a lot more planned. More specifically the ability to browse and edit remote files right from within FirePHP Companion. If this sounds like something that could be useful to you I encourage you to keep an eye out for new feature releases that will be announced on this blog.

1 Comment
December 22, 2010

I was having a heck of a time trying to get this working at first, but with this tutorial mission accomplished.