问题
I searched in all question, I got all answers and suggestions, but none of them helped me.
He's my code:
<?php
ini_alter("memory_limit", "1024M");
ini_set('display_errors', 0);
ini_set('implicit_flush', 'On'); //Inutil já que usa a funcao,, mas vamo testar
error_reporting(0);
set_time_limit(0);
ob_implicit_flush(true);
ob_end_clean();
while (ob_get_level())
ob_end_flush();
ob_start();
for ($i = 0; $i < 5; $i++) {
echo $i . '<br>';
ob_flush();
flush();
sleep(5);
}
echo ini_get('ob_implicit_flush');
die;
?>
And just does not work. If I use echo ob_get_level() after while, the value is zero. In php.ini output_buffering value is Off and ob_implicit_flush is On
In my desktop (ubuntu, apache 2.2, php5.3) works fine. But In my server (centos, httpd 2.2, php5.2), does not work...
Any ideias?
回答1:
Are your php pages compressed? You can't flush the write buffers if you're compressing on the server with gzip.
来源:https://stackoverflow.com/questions/7908299/ob-flush-not-working