Welcome! Log In Create A New Profile

Advanced

Fastcgi buffering

January 23, 2010 06:19AM
I have a php script that uses ImageMagick to process an image. What I'd like to do is to flush the buffers just before the script calls ImageMagick, that way the user at least gets some output in their browser instead of getting an empty page until ImageMagick has done its stuff (which takes a while).

At the moment I'm using a test page to simulate the above situation:
[code]
<?php ini_set('zlib.output_compression', 0);
echo str_repeat("hello\n", 800);
flush();
sleep(5);
?>
bye
[/code]

However, I don't receive the output in the browser until the full page has been processed.

I'm using nginx/0.7.64 proxying to nginx/0.7.59 with spawn-fcgi to start the php processes.

The front end nginx has proxy_buffering off;

I'm guessing this is something to do with fastcgi and the fastcgi buffer settings in nginx, however I tried setting them to what seems to be the minimum, but still don't get the output in the browser (FF3.5) until the php script is completely finished.
[code]
fastcgi_buffers 2 1k;
fastcgi_buffer_size 1k;
fastcgi_busy_buffers_size 1k;
[/code]

So how could I send the output to the browser when flush() is called in the php script?

Thanks

Dave
Subject Author Posted

Fastcgi buffering

djeyewater January 23, 2010 06:19AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 165
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready