Michael
Michael

Reputation: 6405

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.

Upvotes: 0

Views: 306

Answers (3)

Piotr Müller
Piotr Müller

Reputation: 5548

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.

Upvotes: 0

wowo_999
wowo_999

Reputation: 856

use php's flush function

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

http://php.net/flush

Upvotes: 0

BarsMonster
BarsMonster

Reputation: 6585

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

Upvotes: 2

Related Questions