PHP Flush Stopped Flushing in Iis7.5

PHP flush stopped flushing in IIS7.5

You must set the ResponseBufferLimit value of the desired handler to a number low enough to actually flush. I recommend using 0 since it prevents IIS from doing anything but passing along what you send it from your PHP script.
You can use the following command line to set the ResponseBufferLimit to 0 for the php handler (just change “NAME” to the name of the handler you want to update e.g. PHP53_via_FastCGI):

appcmd.exe set config /section:handlers "/[name='NAME'].ResponseBufferLimit:0"

Alternatively, you can edit the applicationHost.config directly and add a ResponseBufferLimit attribute the XML element.

Long running php/fastcgi script hangs on IIS 7.5

If a long running script doesn't communicate with the browser , after 180 seconds or so most browsers will become unresponsive to the server returning the results. The server script wasn't hanging or being terminated, it was the browsers (ie,ff and chrome) becoming unresponsive.

To check this , I ran my script and watched the status of the request.
IIS manager-> select the server-> select worker processes(central pane)->select the application pool-> select view requests (right hand pane) and watched the status and time elapsed columns. You will have to repeatedly click "show all" to see the values updating.

The state changed from ExecuterequestHandler to Sending response and then the script finished as it should but the browsers still looked like they were waiting for the server to respond.

I updated my test script from the above to this to ensure the browsers were being fed responses regularly:

<?php 
@ini_set("output_buffering", "Off");
@ini_set('implicit_flush', 1);
@ini_set('zlib.output_compression', 0);
@ini_set('max_execution_time', 800);

header( 'Content-type: text/html; charset=utf-8' );

echo "Testing time out in seconds\n";
for ($i = 0; $i < 600; $i++) {
echo $i." -- ";

if(sleep(1)!=0)
{
echo "sleep failed script terminating";
break;
}
flush();
ob_flush();
}

?>

The output was't coming back to the browsers bit buy bit as it should and the problem remained.

Next step , I looked at response buffering on the server. The setting was set to a very high number and meant that flushing wouldn't work. So I set ResponseBufferLimit to 0 as per the instructions provided by @Dario in PHP flush stopped flushing in IIS7.5

This solved the problem :) If this solution has helped you please visit the above question and give Dario another +1 from me please, and maybe one to the OP for his question and script.

Thanks

php flush not working

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.

ASP Response.Flush() flushes partial data

One of my coworkers figured out the problem. Gzip compression was enabled on IIS, which was preventing the web browsers getting full chunks of data.

Among the solutions:

Disable compression for all websites:

For IIS 5.1, go to Control Panel/Administrative Tools/Internet Information Services. Right click on Web Sites, click on properties and remove the ISAPI filter Compression.

For IIS 7, go to My Documents/IISExpress/config/applicationHost.config and change the part httpCompression so that compression is not enabled for your particular page.

Disable compression just for your website:

In the web.config file of your application, add the line <urlCompression doStaticCompression="true" doDynamicCompression="false"/> under the section <system.webServer>.

Disable compression for a particular web page or a particular request

These good guys found a way to do it:

Can gzip compression be selectively disabled in ASP.NET/IIS 7?



Related Topics



Leave a reply



Submit