I am using laravel framework and buffering did not work but. This is solution :
header( 'Content-type: text/html; charset=utf-8' );
ob_start();
ob_end_flush();
ob_flush();
flush();
for($i = 1;$i<= 5;$i++){
echo $i;
ob_flush();
flush();
sleep(3);
}
You have to use first ob_end_flush();