I am trying to get some basic output buffering to work and not sure why it isn't...


<?php

echo "Line #1...<br>";
flush();
sleep(2);

echo "Line #2...<br>";
flush();
sleep(2);

echo "Line #3...<br>";
flush();
sleep(2);

echo "Line #4...<br>";

?>

This pauses the 8 seconds and then shows the page completely.

Checking PHPINFO(), output_buffering=4096. I tried using ob_start() and ob_flush to no avail.

I am lost at this....

suggestions....

    Try using ob_start() and then ob_end_flush() instead. When you flush() after each line as you do now, you get the normal behaviour of a PHP-flow.

      But the web server may also use buffering, which would make the web server wait until end of script before sending anything at all to the browser since its buffer has not been filled up, which means you'd either have to turn off web server buffering if possible, or send extra garbage whitespaces to reach the web server buffer size.

        We tried the OB_START with OB_FLUSH... that didn't help.

        Not sure how to check on webserver buffering.

        Any suggestions?

          Write a Reply...