tags:

views:

32

answers:

3
+1  Q: 

apache, php config

I'm running a php application which responds to the client in about 1 minute (keeps loading all this time) . However the response is displayed all at once so I would like to know if there is any config in the apache server/php to display the response at the time is processed . For example I have

 echo "test";
$rez = file_get_contents($URL);

do something ...

But the result from echo is displayed only after the application completed all the tasks(file_get_contents and everything else). So I need to config the server/php to display it at the execution time.

+2  A: 

1) http://php.net/manual/en/function.flush.php

2) output_buffering = off for PHP

3) Disable gzip for PHP

4) Disable gzip in apache

BarsMonster
A: 

use php's flush function

echo "test";
$rez = file_get_contents($URL);
flush();

http://php.net/flush

wowo_999
A: 

If $URL is sending data in real-time, and it isn't source of stopping anyway, you can try to connect by sockets (manually send HTTP request), and when reading incoming data to socket, you can display output continuously writing buffer used to receive socket data and flush()ing it to user browser.

killer_PL