Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • FirePHP

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 399
    Comment on it

    Debugging means finding out the bugs.We all need to be sure that our applications is bug free, so here we have another tool for debugging our application that is "FIREPHP".

    Firephp is a Firefox extension, similiar to FireBug. It enables you to log on your Firbug Comsole using a simple PHP method call i.e we can receive debug information from the server. It is an addon for Firebug ideally suited for AJAX development and requires JSON and XML responses. In firephp,all data is sent through response headers without interfering the contents of the page.

    One considerable benefit of FirePHP is it is feasible to debug a live website/web application without going through the value(s) of each variables, arrays or objects without using primary debugging methods like print_r, var_dump, or logging to a file. We can just use FirePHP, and see to the Firebug console. One of the finest parts about using FirePHP is that logging to the console doesnt create confusion with the normal working of the code.

    Requirements for Installing FIREPHP:

    1.Firefox version 5+
    2.Firebug 1.9+
    

    Here are the steps to start debugging with firePHP.

    1. If not already installed you can install firebug from https://getfirebug.com/downloads.

    2. Install the firePHP extension from https://addons.mozilla.org/en-US/firefox/addon/firephp/.

    After this, the browser will be ready to receive the PHP logs that are sent from the server.

    1. One can download the FirePHPCore library from the link http://www.firephp.org/HQ/Install.htm.

    2. Once downloaded ,extract the FirePHPCore-xxx folder from the zip folder and copy the FirePHPCore-xxx/lib/FirePHPCore folder to the Apache web root folder.

    3. After downloading,start Firefox.Click on the Firebug to open firebug window. Enable the console and net tabs. (enabling the console and net tabs is very important, it will not work without this).

    Let's consider an example: We will create a text file called testfirephp.php and will add following contents:

    #This is how you can include the FirePHP class
    
    require_once(FirePHPCore/FirePHP.class.php);
    
    #Start buffering the output. Not required if output_buffering is set on in php.ini file
    
    ob_start();
    
    #get a firePHP variable reference,we are using $firephpvariable here
    
    $firephpvariable = FirePHP::getInstance(true);
    
    #we are logging todays date as an variable example. you can log whatever you want to
    
    $todays_date_var = date(l jS of F Y h:i:s A);
    
    $firephp->log($todays_date_var, Date);
    ?>
    

    Now,if you will look at the Net tab, you should see:

    X-Wf-1-1-1-1 -> 121|[{"Type":"LOG","Label":"Date","File":"E:\xampp\htdocs\test.php","Line":"12"},"Friday 21st of August 2013 11:06:02 AM"]| The variable X-Wf-1-1-1-1 is exactly the PHP code library sends to the browser and these variables can be looked up by FirePHP extension.

    Hope this will help.Cheers!!

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: