开发者

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.


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


use php's flush function

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

http://php.net/flush


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜