I want to the php file output 1 line per second.
see my code first:
<?php
ob_implicit_flush(true);
for ($i = 0; $i < 5; $i++) {
echo "test $i<br />";
sleep(1);
}
?>
OR
<?php
ob_end_clean();
for ($i = 0; $i < 5; $i++) {
echo "test $i<br />";
flush();
sleep(1);
}
?>
Both not work, they output all the content after 5 seconds. NOT 1 second 1 line.
I tried to change nginx.conf
gzip on; AND gzip off;
and it still NOT 1 second 1 line.
and I also tried to change php.ini
output_buffering = 4096
AND
output_buffering = 0
and it still NOT 1 second 1 line.
HOW CAN I FIX IT ?
SOS!!!