4

I highly prefer the firefox developer inspector than the firebug one.

But is that possible to display PHP logs in the native JS console ?

Thanks :)

4
  • 1
    Firefox Developer Tools runs on the client-side browser code. PHP runs on the server side and produces HTML for the browser to render. So, this is not possible.
    – kaustavdm
    Jun 4, 2015 at 12:14
  • This can be done using FirePHP and the FireBug Console, so your explanation of why it is not possible is not really true ?
    – Spi
    Jun 4, 2015 at 13:04
  • I thought FirePHP sent logs to the browser, which is generally only a good idea in development environment. In a development environment you can keep the local log file open.
    – NoBugs
    Jun 5, 2015 at 2:47
  • firephp sends logs(info/warning/error/…) via http headers. but there is no module to handle this in native console (firebug is required :/ )
    – Asenar
    Jun 7, 2016 at 9:16

1 Answer 1

2

I just installed Chrome Logger ( github | website ) with Chrome PHP to accomplish this in Chrome since Firefox 50+ broke FirePHP. I then learned that Firefox's web console has been supporting Chrome Logger since v43 (https://developer.mozilla.org/en-US/docs/Tools/Web_Console/Console_messages#Server).

So in short, yes, you can log PHP variables to the Firefox web console using Chrome PHP. It's this simple:

  1. Download the latest Chrome PHP library: https://github.com/ccampbell/chromephp
  2. Include it in your project (include 'ChromePhp.php';)
  3. Log something in your php script (ChromePhp::log($_MyArray);)
  4. Open Firefox web console and turn on the Server tab (https://developer.mozilla.org/en-US/docs/Tools/Web_Console/Console_messages#Filtering_by_category)

Hope this helps. I procrastinated upgrading Firefox for a few years before discovering that newer versions had support for this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.