Speedy Wap Speedy Wap - 1 month ago 35
PHP Question

php flush not working

<?php
for($i=0;$i<20;$i++)
{
echo 'printing...<br />';
ob_flush();
flush();

usleep(300000);
}

?>


Url that contains the code: http://domainsoutlook.com/sandbox/delayed.php

I have a dedicated server so I can make the changes. I am running apache and nginx as the proxy server.

Answer

You're using ob_flush without ob_start, so there is nothing to flush for it.

It also depends on the webserver and proxy and its settings.

You should disable buffering for Nginx (add "proxy_buffering off;" to the config file and restart Nginx)

Also, check if your php.ini contains "output_buffering = Off" and "zlib.output_compression = Off".

Comments