FastCGI PHP - unable to prematurely close connection to browser

Rob Schultz rschultz7 at
Sun Feb 7 21:46:50 MSK 2010

> So, still searching for the culprit that doesn't close the connection to browser when Content-Length is reached... :) Any ideas? 
> Or is this a FastCGI issue? Is there any other way to use PHP with NginX?

I believe this is a FastCGI issue. And nginx buffer's the FastCGI response until FastCGI request is completed. The Header("Connection: close"); is only used to prevent using Keep-alive connection. It tells the browser to terminate the connection and not keep them open, thus having no effect on when the data gets to the client. 

A suggestion that might work as your needing is stripping your apache down to only using mod_php and anything else you might want. and basically use it as a PHP process manager.  Then you can just proxy your requests to apache for the php requests and turn proxy_buffering off which then *should* produce the results you require. This allow you to use nginx for your static resources while just utilizing apache as just a PHP manager.


More information about the nginx mailing list