NYCPHP Meetup

[nycphp-talk] flush usage

Nasir Zubair nsr81 at ny-tech.net
Thu Feb 13 14:27:04 EST 2003


It seems that for IE family of browsers, "the first chunk" needs to be
of a certain size. In your example, if I place the following comment
after or before the PHP block, it shows everything as it comes in, if
this is not there, it waits for the whole output and then display it at
once.

<!-- 
alksdjflkasjdflkasjdflkasjdflk sdjflkasjdf klasjdflk asdjflaksd
fjaslkdfjaslkdfjalskdfjalksdfjalskdfakalsdjf
laskdjflkasdjflkasdjfskdflksdalkaklsjdfkajsdlkfj
oweinanbaopisdfonasdlfknasdofinasdlfknasodfinasodifnasidfnl
--> 

http://www.ny-tech.net/test.php

- nasir zubair


-----Original Message-----
From: Chris Shiflett [mailto:shiflett at php.net] 
Sent: Thursday, February 13, 2003 2:11 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] flush usage


--- Carlos Hoyos <cahoyos at us.ibm.com> wrote:
> I have a page that deals with a lengthy process, so I'm using flush to

> "push" the content as it's processed and give the user a feeling of 
> page "in process"

There are many different reasons why this might not be working, and most
involve buffering somewhere (you mention mod_gzip, so I assume you are
aware of some of these issues). I wrote this simple script a good while
ago to play around with flush:

------------------------------
<p><b>Here is an example of a time-delayed list:</b></p>
<ul>

<?
flush();
sleep(3);
echo "<li>List item one</li>";
flush();
sleep(1);
echo "<li>List item two</li>";
flush();
sleep(1);
echo "<li>List item three</li>";
flush();
sleep(1);
echo "<li>List item four</li>";
flush();
sleep(1);
echo "<li>List item five</li>";
flush();
sleep(1);
?>

</ul>
------------------------------

You can try that simple test first and see if it helps.

I have also heard that IE won't display content as it is received unless
the first chunk is greater than ? bytes. Of course, testing with
multiple browsers as you are should eliminate these types of anomalies.

To really verify that your server is sending the proper HTTP message to
allow for the effect you seek, you can view the HTTP response by
telnetting to your Web server and issuing a request manually. Something
like this:

GET /path/to/script.php HTTP/1.1
Host: example.org

You should see a Transfer-Encoding: chunked header in the response, and
there should be no Content-Length header.

Hope that helps.

Chris


--- Unsubscribe at http://nyphp.org/list/ ---







More information about the talk mailing list