I've read many articles and did research online, but I cannot figure out why those commands are not working on my machine. Code get executed but it echoes when whole script is executed. I am testing it with simple code, I will easily implement it later for everything else. Here is the code:
ob_start();
echo "Start ...<br />\n";
for( $i = 0 ; $i < 5 ; $i++ )
{
echo $i."<br />\n";
ob_flush();
flush();
sleep(1);
}
echo "End ...<br />\n";
I tried using ob_end_flush()
, nothing worked for me. I've checked php.ini for configuration it says:
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
I don't know what is wrong, I've also read on php.net "As of August 2012, all browsers seem to show an all-or-nothing approach to buffering. In other words, while php is operating, no content can be shown."
Is my code wrong? Server settings? Browsers? Is there a workaround?