I don't understand why people are
​now ​
saying you
​_​
have
​_​
to use Chrome Logger
​ to log PHP from Firefox.​ That's not true
. In this discussion list,
​see
 the thread entitled "replacement for firephp (devtools)"
​ from late September to early December 2016 (sorry, I don't know how to
link to it). In that thread, Erik, myself, and a couple of others talked
about other ways of getting PHP logging in Firefox, without FirePHP.
(Although FirePHP was certainly better and I wish it would come back to
Firefox.)

Here's the method I use, and it still works:

Set up a separate PHP file in your standard PHP path location. This is
originally based on someone else's script (unfortunately I don't know
whose, so I can't credit him here), but I made some modifications to
simplify it. I call the file PhpToConsole.php. I've removed some of the
devel comments below; its functional contents are:
​
<?php

function phpToConsole( $data ) {

    ob_start();

    $output = 'console.log(' . json_encode( $data ) . ');';
    $output  = sprintf( '<script>%s</script>', $output );

// TOGGLE: Temporarily comment out just the echo line below, if desired to
clear the Console for other (like JS) calls:
    echo $output;

}

?>


​I call it (i.e. log something to the Consol​e) simply like this:

     phpToConsole( "[PHP] My log message including $myVariable goes here."
);

I keep the phpToConsole script in a separate file, and pull it in with
a require_once in every other PHP file, but the script is so short it could
simply be placed at the top of every file that needs it.

Almost featureless, but it's dead simple and works for now.

- Lawrence

-- 
You received this message because you are subscribed to the Google Groups 
"Firebug" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to firebug+unsubscr...@googlegroups.com.
To post to this group, send email to firebug@googlegroups.com.
Visit this group at https://groups.google.com/group/firebug.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/firebug/CAMoMLKj6YGiPeE5a64KK-G8gg%3DV7YjE8MMuXXz%2BQSd7ug3QWyw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to