Muddy_Funster Posted August 28, 2013 Share Posted August 28, 2013 I'm trying to proof a comet style page and to start it up I thought I would set a simple counter in PHP to output 0->3 with a one second delay between each output and flush it to screen each second. Problem is nothing I have tried has actualy managed to flush the buffer out. It just sits there with the loading spinner and after 4 seconds dumps the lot onto the screen at once. I have been diging about and have set the nginx config to the following: user www-data; worker_processes 1; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; events { worker_connections 1024; multi_accept on; } http { include /etc/nginx/mime.types; access_log /var/log/nginx/access.log; sendfile on; tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; tcp_nodelay on; #---------------------------------------------- # fastcgi_keep_conn on; proxy_buffering off; gzip off; #---------------------------------------------- gzip_disable "MSIE [1-6]\.(?!.*SV1)"; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; } I had to comment out the fastcgi_keep_con on; as this wasn't recognised. The following is the PHP page. <?php ini_set('zlib.output_compression', 'Off'); ini_set('output_handler',""); ini_set('implicit_flush',1); set_time_limit(0); ob_start(); header("Cache-Control: no-cache, must-revalidate"); flush(); ob_flush(); for ($i=0;$i<4;$i++) { echo "$i <br>"; ob_flush(); flush(); sleep(1); } ob_end_clean(); ?> Any ideas what I'm missing here? Quote Link to comment https://forums.phpfreaks.com/topic/281631-cant-flush-buffer-with-nginx/ Share on other sites More sharing options...
trq Posted August 28, 2013 Share Posted August 28, 2013 You're using the wrong protocol for this sort of thing. http wasn't made to do what you're asking of it. Quote Link to comment https://forums.phpfreaks.com/topic/281631-cant-flush-buffer-with-nginx/#findComment-1447142 Share on other sites More sharing options...
Muddy_Funster Posted August 28, 2013 Author Share Posted August 28, 2013 well I am deffinately open to suggestions on alternatives, since none are forthcoming on making this work. I wonder why there are so many resources on COMET applications using this setup which completly ignore that it's not supposed to be done....damn internet Quote Link to comment https://forums.phpfreaks.com/topic/281631-cant-flush-buffer-with-nginx/#findComment-1447144 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.