Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to make it so that I can output to the console in PHP. I have already installed FireFox with the FireBug and FirePHP addons.

I downloaded the 'FirePHPCore Server Library' from here and I uploaded it into 'wp-content/themes/Jupiter/includes' (my theme is called Jupiter).

Then, from within the loop of a template page, I wrote the following code:

<?php
include_once('includes/FirePHPCore/FirePHP.class.php');
include_once('includes/FirePHPCore/fb.php');

ob_start();
FB::warn("Warning message!");
?>

I have tried to put the includes in functions.php and I have tried using the OO/Procedural calls and nothing seems to be working. What am I missing? Is there an easier way of doing this?

Warning Information

I turned wp_debug on in order to get the following output when attempting to add a debug line:

Fatal error: Uncaught exception 'Exception' with message 'Headers already sent in /home5/alumnicl/public_html/beta/main/wp-content/plugins/jupiter-framework/jupiter-framework.php on line 32. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.' in /home5/alumnicl/public_html/beta/main/wp-content/themes/Jupiter/includes/FirePHPCore/FirePHP.class.php:1178 Stack trace: #0 /home5/alumnicl/public_html/beta/main/wp-content/themes/Jupiter/includes/FirePHPCore/FirePHP.class.php(757): FirePHP->newException('Headers already...') #1 /home5/alumnicl/public_html/beta/main/wp-content/themes/Jupiter/includes/FirePHPCore/fb.php(64): FirePHP->fb('hello world', 'Message Title') #2 /home5/alumnicl/public_html/beta/main/wp-content/themes/Jupiter/control-display.php(28): fb(Array, Array) #3 /home5/alumnicl/public_html/beta/main/wp-includes/template-loader.php(47): include('/home5/alumnicl...') #4 /home5/alumnicl/public_html/beta/main/wp-blog-header.php(16): require_once('/ho in /home5/alumnicl/public_html/beta/main/wp-content/themes/Jupiter/includes/FirePHPCore/FirePHP.class.php on line 1178

I have already included ob_start() directly before the require statement - should I be putting it somewhere else?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

I use it including the file (Match you actual file location):

require '../../FirePHPCore/fb.php';

and then call by using

fb( $variable, 'Message Title');

Be sure that you've installed and activated the FirePHP addon on Firefox.

There's also a WordPress plugin for FirePHP, but I've never used it.

share|improve this answer
    
That's basically what I've done already - check out my update with the wp_debug output - –  William Apr 9 '13 at 5:16
    
Do you have any spaces before <?php at the start of your file? –  RRikesh Apr 9 '13 at 5:20
    
Since you're using it in your include files, I can't say for sure. But you should send your logging messages well before you start sending your actual HTML. –  RRikesh Apr 9 '13 at 5:30
add comment

Like RRikesh said, you need to put your include and buffer statement before any HTML is sent to the client. In other words, this probably needs to go in the top of your header.php file.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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