Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6119989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:37:00+00:00 2026-05-23T15:37:00+00:00

I get unexplained Headers already sent on line #… error on those 2 lines

  • 0

I get unexplained “Headers already sent on line #…” error on those 2 lines that execute “echo …” in the code below.

Simplified version of the case:

<?php
ob_start();

//Initializing FirePHP...
include_once(F_FS_PATH."lib/FirePHPCore/fb.php");
// <--- I've also tried to move the ob_start(), after the FirePHP init,
// <--- instead before it. But it made no difference.
?>
<html>
<div>A lots of HTML (and php) code goes here... Actually my entire page.
FirePHP is also used here many times by multiple invocations
of the function fb('debug text');</div>
</html>

<?php
$all_page_content=ob_get_clean();

if ($GLOBALS["marketing_enabled"])
    echo marketingReplaceContent($all_page_content);
else
    echo $all_page_content;

ob_flush(); flush();

//Do some other non-printing - but slow stuff.
do_the_silent_slow_stuff_Now();

// <--- presumably the php execution ends here.
?>

I cannot understand why FirePHP is trying to do something upon page completion after I print the buffer and flushed it? Or what is it trying? How can I cope with this problem? 🙁

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:37:01+00:00Added an answer on May 23, 2026 at 3:37 pm

    Here’s your problem:

    Headers already sent on line #…

    Thats exaclty what happens when you use FirePHP and echo something beforehand. This might even be a whitespace before the <?php tag. FirePHP sends all its content as a header, and headers can’t be send after any output is made.

    Since I’m sure that you call FirePHP in your do_the_silent_slow_stuff_Now(); method I recommend not to use buffering, flushing and FirePHP at once.

    Either you resign on ob_start() and ob_flush() during the development phase or you call the ob_flush() method after all stuff is done.

    Third possibility would be to seperate your development and live phase by doing something like $development = true; and make your own FirePHP function:

    function my_fb($text) {
        if(!$development)
            fb($text);
    }
    

    and:

    if($development) {
        do_the_silent_slow_stuff_Now();
        ob_flush(); flush();
    }
    else {
        ob_flush(); flush();
        do_the_silent_slow_stuff_Now();
    }
    

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get Compiler Error C2248 when i try to compile the following code: #include
I get the following error even when my JAVA_HOME is set correctly. C:\workspace-sts-2.8.0.RELEASE\JBClient\target>echo %JAVA_HOME%
Get this simple python code, same matching with re.compile instance. I noticed that even
I get the following error when trying to execute a mail merge from access
i get this error: Traceback (most recent call last): File <stdin>, line 1, in
Get the following error when I run autotest. The weird thing is that I
I get this error while accessing a php script: W/System.err: Error reading from ./org/apache/harmony/awt/www/content/text/html.class
I get this error while installing cmake on my machine. Error: Target org.macports.configure returned:
I get the following error in my android app: The type of the expression
get a complier error while trying to do float_val=float_val<<1; It gives out a error

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.