Welcome! Log In Create A New Profile

Advanced

Re: How to disable output buffering with PHP and nginx

All files from this thread

File Name File Size   Posted by Date  
nginx.conf 2.7 KB open | download B.R. 10/07/2013 Read message
test.php 77 bytes open | download B.R. 10/07/2013 Read message
php.ini 67.3 KB open | download B.R. 10/07/2013 Read message
nginx_php_backend.pcapng 5.5 KB open | download B.R. 10/07/2013 Read message
B.R.
October 07, 2013 06:00PM
Hello,


On Mon, Oct 7, 2013 at 5:35 PM, Francis Daly <francis@daoine.org> wrote:

> Run the fastcgi server like this:
>
> env -i php-cgi -d cgi.fix_pathinfo=0 -q -b 9009
>
> Use an nginx config which includes something like this:
>

​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).
First Ben​

​should ensure that php-cgi and php-fpm shares the exact same ini
configuration. That's a common caveat... :o)


> ==
> location = /php {
> fastcgi_param SCRIPT_FILENAME /usr/local/nginx/test.php;
> fastcgi_pass 127.0.0.1:9009;
> }
> ==
>
> Then do something like
>
> tcpdump -nn -i any -A -s 0 port 9009
>
> while also doing a
>
> curl -i http://127.0.0.1:8080/php
>
> and look at the network traffic from the fastcgi server.
>
> If you don't see a five-second gap between the two different response
> packets, it is being buffered before it gets to nginx.
>

​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.​

Now make whichever please-don't-buffer changes seem useful in the php code
> and in the fastcgi server configuration. When you can see non-buffered
> output getting to nginx, then you know the non-nginx side is doing what
> you want. So now you can start testing nginx configuration changes;
> and you can share the exact non-nginx configuration you use, so that
> someone else can copy-paste it and see the same problem that you see.
>
> (Change 127.0.0.1:9009 to be whatever remote server runs your fastcgi
> server, if that makes it easier to run tcpdump.)
>
> Good luck with it,
>

​I share the wish. :o)
Please share the results of every step with us for we could help you
further.​
---
*B. R.*
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

How to disable output buffering with PHP and nginx

Ben Johnson September 16, 2013 01:22PM

Re: How to disable output buffering with PHP and nginx

Ben Johnson October 07, 2013 03:24PM

Re: How to disable output buffering with PHP and nginx

itpp2012 October 07, 2013 04:25PM

Re: How to disable output buffering with PHP and nginx

Francis Daly October 07, 2013 05:36PM

Re: How to disable output buffering with PHP and nginx

B.R. October 07, 2013 06:00PM

Re: How to disable output buffering with PHP and nginx

Maxim Dounin October 07, 2013 07:20PM

Re: How to disable output buffering with PHP and nginx Attachments

B.R. October 07, 2013 11:00PM

Re: How to disable output buffering with PHP and nginx

Maxim Dounin October 08, 2013 11:50AM

Re: How to disable output buffering with PHP and nginx

Ben Johnson October 10, 2013 11:14AM

Re: How to disable output buffering with PHP and nginx

Maxim Dounin October 10, 2013 11:28AM

Re: How to disable output buffering with PHP and nginx

Ben Johnson October 10, 2013 12:50PM

Re: How to disable output buffering with PHP and nginx

itpp2012 October 10, 2013 01:35PM

Re: How to disable output buffering with PHP and nginx

Maxim Dounin October 10, 2013 02:26PM

Re: How to disable output buffering with PHP and nginx

Ben Johnson October 12, 2013 04:40PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 115
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready