1

I have a module that I've created to test ob_flush buffering off. I need to understand it so I can have some longer modules buffer output to the page as the script goes through long processes. The code is working, however it is showing above the header of the page instead of in the module section (between the header and footer).

Here is the output buffering code:

<?php
// Turn off output buffering
ini_set('output_buffering', 'off');
// Turn off PHP output compression
ini_set('zlib.output_compression', false);

//Flush (send) the output buffer and turn off output buffering
while (@ob_end_flush());

// Implicitly flush the buffer(s)
ini_set('implicit_flush', true);
ob_implicit_flush(true);
ob_start();

for($x=0; $x<25;$x++) {
    echo "X=" . $x; 
    echo str_pad("",1024," ");
    echo "<br />";
    ob_flush();
    flush();

    sleep(1);        
} 


echo "Program Output";
ob_flush();
flush();
?>

Any insight on how to get this working properly would be appreciated. Here is a picture of the output:

enter image description here

Thanks, Chas

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.