I have a ajax call to somefile.php . i want the php script to do a simple task and than send back data to the user, and only than do very time consuming tasks. so i need to flush the output after the first simple task. it doesn't work, probably because i have gzip enables.
I definitely don't want to disable gzip across all the vhost, and also not in all the folder where somefile.php is. i just want to disable it for this specific file. is that possible?
EDIT:
this is what i've included in my apache conf:
<FilesMatch .php$>
SetEnv no-gzip 1
</FilesMatch>
this is my php script:
<?php
$sucesss = @apache_setenv('no-gzip', 1);
@ini_set('zlib.output_compression', 0);
@ini_set('implicit_flush', 1);
ob_start();
for($i=0;$i<10;$i++)
{
echo 'printing...';
ob_flush();
flush();
sleep(1);
}
?>
it doesn't work. i still see all the output together after 10 seconds.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…