Code: Select all
<?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);
echo "add this";
echo str_pad("",1024," ");
echo "<br />";
ob_flush();
flush();
sleep(5);
echo "Program Output";
ob_flush();
flush();
?>
The code works as expected outside joomla (see https://www.cbbfl.com/flush.php). It displays the 'Add This' line. Then waits 5 seconds and displays the 'Program Output' line.
I've created a custom module to test the same. You can reach that by navigating to https://www.cbbfl.com/joomla33/home. Once there, click the 'Test' menu option.
You'll see that it runs just like flush.php did and then displays the joomla header (navigation section) and foot (copyright & To Top link). This is wrong as the output should be between these 2 sections.
Any assistance to resolve this would be greatly appreciated as I have a number of pages with longer running scripts that I would like to update the user on what is happening.
Thanks in advance for any help.