ChromePhp / FirePHP alternative for Firefox Quantum: server log to the developer console

By Frank Forte

This week, Firefox 57 (Firefox Quantum) was released (2017-11-15). It was a breath of fresh air. It felt more than twice as fast. I was ready for a productive day.

That first breath was so nice that I inhaled again, but this time is didn’t smell so sweet. It was like walking around in downtown Toronto. You could smell something awesome one moment, then when you try to get another whiff, you smell something pungent.


TL;DR, server logs from ChromePhp stopped working, so I rolled a new version: QuantumPHP on GitHub


Within minutes, I noticed two things that I didn’t like.

1) When the MS Windows hosts file is updated (for example, to point a domain to our QA servers), the browser continues to point traffic to the previous IP address. Shift refresh will send traffic to the correct IP, where I am able to add an SSL exception for the QA server. However, subsequent requests continue to go to the old ip address. Flush DNS and renew DNS did not help.

2) Server logs were removed. All that helpful information sent back via ChromePHP just stopped working.

Now, #1 is nothing new. Firefox likes to cache the ip address for domain names, and it does not like to update that cached information. I was just hoping that this new version would be a bit smarter about updating this type of cached information, especially after the Dyn DNS attack last year.

On the other hand, #2 was a surprise. I thought that maybe I just needed to turn it on somewhere, but a Google search revealed this statement by Nicolas Chevobbe:

Server logs are no longer supported natively since there are no parts of the ConsoleAPI specification and there is a webextension to make them available.

I could not find the "webextension" that Nicolas mentioned, so I created QuantumPHP to get my server side logs showing up again. So I rolled my own one of those too: QuantumPHP add-on for Firefox . If you don’t want to use the add-on, you can manually add the JavaScript file, QuantumPHP.js, to your web page HTML to make it work.

I hope it can serve a lot of the ChromePHP and former FirePHP users.

I added some big improvements on ChromePHP, notably:

A) comments can be easily added in your PHP script, and the output in the developer tools console will be a table, including the time, file and line number where the comment was added.

B) You can set a maximum header size, so that Apache does not throw up and show a 503 page when you send a header above 8MB. QuantumPHP will truncate your log and warn you.

C) Firefox now handles tables in the console log infinitely better. Objects and arrays can be expanded easily to view deep properties, and the column widths can be properly resized (they also stretch when the browser window stretches). This was not the case in the previous version.

In case you are wondering why I don’t just use Chrome for development, it is because the issues there were more serious than the issues in Firefox. For example, it seems to choke on medium to large logs (where the HTTP response header size is relatively large). The console simply does not display the logs.

It was not fun coming into work and realizing that one of my important tools was broken. But now I have a new tool, and I like it better.



Tags: , , ,
This entry was posted on Saturday, November 18th, 2017 at 12:05 am and is filed under PHP, Software Development. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.