<div dir="ltr"><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">Hello,<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 7, 2013 at 5:35 PM, Francis Daly <span dir="ltr"><<a href="mailto:francis@daoine.org" target="_blank">francis@daoine.org</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Run the fastcgi server like this:<br>
<br>
  env -i php-cgi -d cgi.fix_pathinfo=0 -q -b 9009<br>
<br>
Use an nginx config which includes something like this:<br></blockquote><div><br><div class="gmail_default" style="font-size:small;color:rgb(51,51,153);display:inline">​I would recommend being careful about that experiment since there is a high probability that Ben uses php-fpm (it's actually the recommended way compared to the old FastCGI + php-cgi and the related issues).<br>


</div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153);display:inline">First Ben​</div> <div class="gmail_default" style="font-size:small;color:rgb(51,51,153);display:inline">​should ensure that php-cgi and php-fpm shares the exact same ini configuration. That's a common caveat... :o)<br>


​<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
==<br>
  location = /php {<br>
    fastcgi_param SCRIPT_FILENAME /usr/local/nginx/test.php;<br>
    fastcgi_pass <a href="http://127.0.0.1:9009" target="_blank">127.0.0.1:9009</a>;<br>
  }<br>
==<br>
<br>
Then do something like<br>
<br>
  tcpdump -nn -i any -A -s 0 port 9009<br>
<br>
while also doing a<br>
<br>
  curl -i <a href="http://127.0.0.1:8080/php" target="_blank">http://127.0.0.1:8080/php</a><br>
<br>
and look at the network traffic from the fastcgi server.<br>
<br>
If you don't see a five-second gap between the two different response<br>
packets, it is being buffered before it gets to nginx.<br></blockquote><div><br><div class="gmail_default" style="font-size:small;color:rgb(51,51,153);display:inline">​That's the best way of proceeding since it uses the exact environment PHP will be using for production-ready code. Wireshark may be used to read pcap dumps with a nice graphical presentation.​<br>

<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Now make whichever please-don't-buffer changes seem useful in the php code<br>
and in the fastcgi server configuration. When you can see non-buffered<br>
output getting to nginx, then you know the non-nginx side is doing what<br>
you want. So now you can start testing nginx configuration changes;<br>
and you can share the exact non-nginx configuration you use, so that<br>
someone else can copy-paste it and see the same problem that you see.<br>
<br>
(Change <a href="http://127.0.0.1:9009" target="_blank">127.0.0.1:9009</a> to be whatever remote server runs your fastcgi<br>
server, if that makes it easier to run tcpdump.)<br>
<br>
Good luck with it,<br></blockquote><div><br><div class="gmail_default" style="font-size:small;color:rgb(51,51,153);display:inline">​I share the wish. :o)<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153);display:inline">


Please share the results of every step with us for we could help you further.​<br></div></div>---<br></div><font size="1"><span style="color:rgb(102,102,102)"></span><b><span style="color:rgb(102,102,102)">B. R.</span></b><span style="color:rgb(102,102,102)"></span></font>
</div></div>