nginx and php header + flush
mdounin at mdounin.ru
Fri Sep 2 11:57:16 UTC 2011
On Fri, Sep 02, 2011 at 07:50:32AM -0400, ykse wrote:
> Hello guys,
> I've got strange problem with my webserver. I've got nginx and apache
> with php as backend www server, and now when I tryin to run this code
> header('HTTP/1.x 404 Not Found');
> echo "sometext";
> ( it's on apache )
> nginx returns something like this ->
> 8 sometext 0
> As you can see it's returns some numbers, but why ? When I'm openning
> same script directly from apache it's returns only "sometext" without
> any numbers.
> Do you have any idea why nginx returns this numbers ?
These numbers are from chunked encoding incorrectly sent by apache
to nginx. This behaviour is the result of a bug in apache's
mod_php which forces HTTP/1.1 reply despite the fact client
(nginx) uses HTTP/1.0 in request.
To fix this, just change
in your php code, or use "SetEnv downgrade-1.0" in apache config
as a workaround if changing code is problematic for some reason.
See  for more information.
More information about the nginx