Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
717 views
Welcome To Ask or Share your Answers For Others

1 Answer

I was looking for a solutions for the same issue. This is what worked for me but unfortunately it seams NOT to be a VALID header.

<?
header("Content-Encoding: none");
?>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...