logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: php-cgi flush() doesnt work?
Author
PipoDeClown



Joined: 20 Dec 2005
Posts: 77

PostPosted: Mon 07 Apr '08 9:13    Post subject: php-cgi flush() doesnt work? Reply with quote

- installed ApacheLounge's VS2008 version of Apache2.2 and mod_fcgid
- installed PHP 5.2.5 thread safe version
- config fcgid: OutputBufferSize 0
- config php: output_buffering = Off; implicit_flush = On
Code:
<?php
for ($i = 0; $i < 10; $i++) {
    echo $i . '<br />';
    flush();
    sleep(1);
}
?>

instead of the expected result: seeing the numbers appear one by one, the full output is shown when the script ends.

i had it working though, but maybe it was apache.org's version with php nonthreadsafe, but not much time to research that at the moment.

edit: btw the code works as expected in iis 5.1/6.0 with the fastcgi extension (ResponseBufferLimit=0)


Last edited by PipoDeClown on Mon 07 Apr '08 11:35; edited 3 times in total
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7294
Location: Germany, Next to Hamburg

PostPosted: Mon 07 Apr '08 9:29    Post subject: Reply with quote

I think you have to disable implicit_flush.

A better way is using ob_start and ob_flush

implicit_flush = On
Quote:

Changing this to TRUE tells PHP to tell the output layer to flush itself automatically after every output block


flush()
Quote:

flush() has no effect on the buffering scheme of your web server or the browser on the client side. Thus you need to call both ob_flush() and flush() to flush the output buffers.
http://de.php.net/ob_start
Back to top


Reply to topic   Topic: php-cgi flush() doesnt work? View previous topic :: View next topic
Post new topic   Forum Index -> Apache