文章标签 ‘fastcgi’

转载时请标明文章原始出处和作者信息, 作者: lostsnow.http://www.lsproc.com/blog/use_ob_flush_on_nginx_fastcgi/
Nginx与php-cgi是两个独立的程序,通过TCP或Unix套接字通信,不像Apache那样是集成在一起的。所以,Nginx有fastcgi 缓冲区,数据超出缓冲区大小、或程序执行完,才会将内容输出到客户端。如果要使用ob_flush,不能开启gzip压缩输出。
nginx.conf:
fastcgi_buffer_size 4k;
fastcgi_buffers 8 4k;
gzip off;
php.ini:

output_buffering = Off

<?php
set_time_limit(0);
ob_end_clean();
ob_implicit_flush(1);

for($i = 0; $i < 10; $i++)
{
echo $i . "<br />\n";
echo str_repeat('', 1024*4);
sleep(1);
}

其中 echo str_repeat('', 1024*4);
使得fastcgi_buffer_size 4k; 的缓冲区满,从而输出内容到浏览器
参考: http://blog.s135.com/nginx_php_v6/2/1/
-- EOF --

2010年3月8日11:45 | 没有评论

转载时请标明文章原始出处和作者信息, 作者: lostsnow.http://www.lsproc.com/blog/lighttpd_phpfastcgi_config/
php(fastcgi) 5.2.6 编译参数

./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-gd=/usr --enable-calendar --with-zlib --with-bz2 --with-curl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-openssl --enable-zend-multibyte --with-gettext --enable-exif --with-png-dir=/usr --with-jpeg-dir=/usr --with-libxml-dir=/usr --enable-gd-native-ttf --enable-dom --with-freetype-dir=/usr --with-iconv-dir=/usr --enable-fastcgi

lighttpd 1.5.0 编译参数

./configure --prefix=/usr/local/lighttpd --with-mysql=/usr/bin/mysql_config --with-openssl --with-pcre --with-bzip2 --enable-lfs --with-linux-aio

添加fastcgi 及lighttpd执行用户

groupadd www
useradd -g www -s /sbin/nologin -d /dev/null www

复制lighttpd源码包内 doc/spawn-php.sh 并修改如下

#!/bin/bash

## ABSOLUTE path to the spawn-fcgi binary
SPAWNFCGI="/usr/local/lighttpd/bin/spawn-fcgi"

## ABSOLUTE path [...]

2008年6月15日19:06 | 没有评论
标签: , ,