This function works perfectly on my other server and locally on my pc showing every second the numbers, but when I send the cloud code from my client it only shows the results after the page loads 100%.
It works correctly here: http://kicklaunch.me/buffer.php
In this only when the page loads completely: http://raio.adm.br/buffer.php
Both servers have the same PHP version 5.4.45
<?php
for($i=0; $i<20; $i++) {
echo 'printing...'."<p>";
ob_flush();
flush();
sleep(1);
}
?>
SOLUTION
output_buffering = Off
ob_implicit_flush(1);
for($i=0; $i<10; $i++){
echo $i;
//this is for the buffer achieve the minimum size in order to flush data
echo str_repeat(' ',1024*64);
sleep(1);
}