1

I am trying to switch firefox developer tools for server side debugging because firebug is no longer working with firePHP.

Checked the documentation I found this information:

Firebug extensions like FirePHP allow to log server-side messages to the Firebug console. This functionality is already integrated into the DevTools using the ChromeLogger protocol and doesn't require any extensions to be installed.

I integrated chrome logger to my PHP script tested with Chrome and made sure it is working. But on Firefox Dev Tools nothing appears on the console. I checked the headers for X-ChromeLogger-Data. Encoded data is passed successfully.

Any one have an idea for solution?

For reference developer.mozilla.org/en-US/docs/Tools/Web_Console/Console_messages#Server

Tested with Firefox Developer Edition 56.0b3 and ChromePhp 4.1.0 (Chrome logger php script)

EDIT: There is something strange. There 2 different Developer Tools, One opens with F12 and there are no server tab, and the other opens via Tools>Web Developer menu

Server Tab displays nothing about chrome logger

Screen Shots are here:

Server option enabled

Two different Tool Boxes

Grant Miller
  • 27,532
  • 16
  • 147
  • 165
Zortext
  • 566
  • 8
  • 21
  • do you have the server tab clicked? it should be the same color as the rest of the tabs "net,css,js ..." under the console – cmorrissey Aug 18 '17 at 14:08
  • I'm sorry to say, but as a lover of FirePHP I was very disappointed with Firefox's server logging capabilities. It won't show multiple lines in a string, and doesn't show other data nearly as well as FirePHP did. So what I did (for Ubuntu Linux) was install a second version of FireFox (version 48). Now I can still use FirePHP. I you want to install more than one FireFox you can do it, but remember to go in and tell it not to update itself, and NEVER look at the about page. – Brian Gottier Aug 18 '17 at 14:34
  • @cmorrissey please see the edited post about server tab. – Zortext Aug 20 '17 at 10:35

3 Answers3

1

As of 2017, firebug and hence firephp has been disabled.

I wrote some little modifications to the chromephp tool to allow seamless migration from firephp to chromephp for debuging via the console.

This article explains in clear easy steps

https://medium.com/@kudehinbuoluwaponle/migrate-from-firephp-to-chromephp-in-5-minutes-without-breaking-existing-code-e4afd1b28c5c

As an addition to the details in the article, you don't need to switch to chrome browser, You can also view the logs via the server tab of the firefox web console

Kudehinbu Oluwaponle
  • 1,045
  • 11
  • 11
  • 1
    Good work and good article Kudehinbu. The trick seems to be to refactor the QuantumPHP class to object context. I did this to benefit from the __destruct() method, hence issuing the ->send() "for free", and automatically at the end of each PHP page. – Fabien Haddadi Feb 21 '18 at 06:59
1

With Firefox 57, a.k.a. Firefox Quantum, it looks like server logs from ChromePhp no longer work.

QuantumPHP is an alternative. With this tool, the server log and JavaScript log both appear under "console".

https://github.com/frankforte/quantumphp

Frank Forte
  • 2,031
  • 20
  • 19
1

Further to Kudehinbu's work, and my own work, i.e refactoring the QuantumPHP class provided https://github.com/frankforte/quantumphp, to give developers a more seamless approach and migration process from FirePHP, I may also add that unlike FirePHP, the client-side rendering will not go over a laconic [object Object] when an object is part of the arguments to the info(), warn() or error() method.

To develop an object exhaustively, like FirePHP did, you may want to transform $args using print_r() or var_export(), either before the call to an output method of the QuantumPHP class, or better, as a private/protected transformer within the class itself.

protected function resolveObjectArgs(array &$args)
{
    array_walk($args, function(&$value, $key) {
        if (is_array($value)) {
            $value = print_r($value, true);
        }
        else if(is_object($value)) {
            $value = var_export($value, true);
        }
        else return;
    });
}

Thus calling this transformer within an output method:

public function info()
{
    $args = func_get_args();
    $this->resolveObjectArgs($args); // <== this is the line to add to the existing code
    return $this->_log(self::INFO, $args);
}

Note that following my refactoring, info() is now public and no more public static, since I decided to use the object context.

Finally, taking advantage of the public context, you may want to add a destructor:

public function __destruct()
{
    $this->send();
}

thus saving from explicitly calling the send method systematically after your PHP script's last call to a QuantumPHP method.

Example of client-side use:

$QPHP = QuantumPHP::getInstance();
$Obj = new MyOwnObject();
$QPHP->info($Obj); // will eventually output a detailed structure of your object

// send() gets called magically at the end of the page!
Fabien Haddadi
  • 1,814
  • 17
  • 22