I moved my files to a new server and I had a script that instantly showed output on every echo
to the browser, but this isn't working on the new server. Here is my test code:
@ini_set('output_buffering', 0); @ini_set('implicit_flush', 1);
for ($i = 0; $i < ob_get_level(); $i++) ob_end_flush();
ob_implicit_flush(1);
ignore_user_abort(true); set_time_limit(0);
$max_wait_time = 30;
$begin_time = microtime(true);
$elapsed_time = 0;
while(!connection_aborted()) {
echo $i++.str_repeat(' ', 1020).'<br/>';
flush(); ob_flush();
usleep(1000000);
if($elapsed_time > $max_wait_time){ break; }
$elapsed_time++;
}
I've tried a few things which has become the above. But turning output buffering on and flushing hasn't worked for me. I have tested this on Chrome and Firefox, they both just output everything at the end.
Any ideas?
flush()
documentation says, you cannot guarantee [from within PHP] that there is nothing else buffering the data. Messing around with Apache settings might help, if that's possible for you, but otherwise I would suggest aiming for an alternate solution. – Dendrochronology