FirePHP
Permalink
Is anyone using this PHP debug tool from Mozilla? I notice the Wiki Server Libraries (http://www.firephp.org/Wiki/ ) have everyone under the sun EXCEPT Concrete5. Is there any solution or advice on this?
interesting, i just use Log::add though :)
You need to have the extension installed (https://addons.mozilla.org/en-US/firefox/addon/6149/eula/71900?src=addondetail) and the pear library installed for this to work. Also, output buffering needs to be turned on in your php.ini. Assuming all of that, create a new helper called jbx_firephp.php.
Add the following code:
Then, anywhere on your site, you can do this:
I did also get it working with exceptions, however, it slowed everything down massively! Randomly chucking out vars to firebug is brilliant though. I used to just die(var_dump($var)); all of the time, which is a real pain. And with concrete's built in logger, although it is very good, it's not quite as tidy as having everything there in Firebug. I like it :)
Jon
# pear channel-discover pear.firephp.org # pear install firephp/FirePHPCore
Add the following code:
Then, anywhere on your site, you can do this:
<?php JbxFirephpHelper::log($variable) ?>
I did also get it working with exceptions, however, it slowed everything down massively! Randomly chucking out vars to firebug is brilliant though. I used to just die(var_dump($var)); all of the time, which is a real pain. And with concrete's built in logger, although it is very good, it's not quite as tidy as having everything there in Firebug. I like it :)
Jon
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); require_once('FirePHPCore/FirePHP.class.php'); class JbxFirephpHelper { public function log($var, $type = null) { $firephp = FirePHP::getInstance(true); switch($type) { case 'log' : $firephp->log($var); break; case 'info' : $firephp->info($var); break; case 'warn' : $firephp->warn($var); break; case 'error' : $firephp->error($var); break; case 'dump' : $firephp->dump($var); break; case 'trace' : $firephp->trace($var); break; case 'exception' : $firephp->error($var); break; case 'table' : $firephp->table('Output:', $var); break; default : $firephp->log($var, $type); break;
Viewing 15 lines of 18 lines. View entire code block.
Be warned tho, as I mentioned above, sending exceptions or traces can be very slow. They do work, just may take 30s to a minute to process...
Jon
Sweet! (-; Great tool for working on a remote site. Thanks for your time and sharing this.
Thanks Jon
Thanks Jon
There are some solutions to reducing the volume of data when sending exceptions and traces:
http://www.christophdorn.com/Blog/2010/10/15/tip-firephp-data-volum...
http://www.christophdorn.com/Blog/2010/10/15/tip-firephp-data-volum...
Thanks Jon, this helper is great. Works perfect for my theme files but I'm having trouble getting it to work with my blocks edit.php file. Is it something related to the Ajax loading?
here's the error:
I have ob_start(); in my theme's header.php file... but still this error.
How to do debugging with FirePHP within a block's add/edit.php file?
update: was due to a random ob_end_flush() call before the firephp :)
here's the error:
Fatal error: Uncaught exception 'Exception' with message 'Headers already sent in /Applications/MAMP/htdocs2/AIBB/concrete/elements/dialog_header.php on line 2. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.'
I have ob_start(); in my theme's header.php file... but still this error.
How to do debugging with FirePHP within a block's add/edit.php file?
update: was due to a random ob_end_flush() call before the firephp :)
I am trying to get FirePHP to work with your little helper but my Firebug console remains empty, nothing gets logged....
Here my specs:
Firefox 8.01
Firebug 1.8.4
FirePHP 0.6.2
Plus I've enabled output_buffering in my php.ini
?!?!? :-/
Here my specs:
Firefox 8.01
Firebug 1.8.4
FirePHP 0.6.2
Plus I've enabled output_buffering in my php.ini
?!?!? :-/
Oh false alarm........my fault.........the network panel was not enabled in Firebug, sorry ;-)
It works fine now.
It works fine now.
Another way to get FirePHP working is to just drop the downloaded files into your libraries folder, then load it:
You can then use FirePHP normally, without having to create your own helper.
Loader::library('FirePHPCore/fb');
You can then use FirePHP normally, without having to create your own helper.
And an even simpler way to get it working is to just require it in the root index.php file.
Now you have FirePHP available to you globally, without having to load it every time you want access it.
require('libraries/FirePHPCore/fb.php'); require('concrete/dispatcher.php');
Now you have FirePHP available to you globally, without having to load it every time you want access it.