php-fpm 现在php官方内部已经出版本了,据说以后会出现在 php core 里,如果现在安装的话,可以svn得到最新代码,我抢先为快。 至于缓存,我用的facebook 试用的apc 测试了一段时间还很,满意。
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.02.tar.bz2

wget
http://monkey.org/~provos/libevent-1.4.13-stable.tar.gz

wget
http://pecl.php.net/get/APC-3.1.3p1.tgz
tar zxvf pcre-8.02.tar.bz2

cd pcre-8.02

./configure --enable-utf8 --enable-pcregrep-libbz2

make

make install

tar zxvf libevent-1.4.13-stable.tar.gz

cd libevent-1.4.13-stable

./configure --prefix=/usr

make

make install
tar jxvf php-5.3.2.tar.bz2

cd php-5.3.2

svn co http://svn.php.net/repository/php/php-src/trunk/sapi/fpm sapi/fpm

./buildconf --force

./configure --prefix=/usr/local/php --enable-fpm --disable-debug --disable-safe-mode --disable-ipv6 --enable-ftp --enable-zip --with-libevent-dir --with-fpm-user=www --with-fpm-group=www --with-config-file-path=/usr/local/php/etc --with-libxml-dir --with-openssl --with-pcre-regex --with-zlib --with-zlib-dir --with-bz2 --with-curl --with-libxml-dir --with-pcre-dir --with-openssl-dir --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --with-gettext --with-mhash --with-ldap --with-ldap-sasl --with-mcrypt --with-mysql=mysqlnd --with-mysql-sock=/tmp/mysql.sock --with-zlib-dir --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib-dir --with-openssl-dir --with-libxml-dir --with-libxml-dir --with-libxml-dir --with-iconv-dir=/usr/local --with-pear

make ZEND_EXTRA_LIBS='-liconv'

make install

cp php.ini-production /usr/local/php/etc/php.ini

cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

chmod 755 /etc/init.d/php-fpm
安装额外的 插件
tar zxvf APC-3.1.3p1.tgz

cd APC-3.1.3p1

./configure --enable-apc --enable-mmap --with-php-config=/usr/local/php/bin/php-config

make

make install

tar zxvf memcache-2.2.5.tgz

cd memcache-2.2.5

./configure --with-php-config=/usr/local/php/bin/php-config

make

make install
cd /usr/local/php/etc

mkdir fpm.d

vim php.ini
把 extension_dir = "./" 改为

extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/"
extension = "memcache.so"
;因为最新版本的 apc 是不需要加任何参数,默认就是启动的
extension = "apc.so"

mv php-fpm.conf php-fpm.conf.bak
cat php-fpm.conf
;
; Global
;
pid = /usr/local/php/var/run/php-fpm.pid
error_log = /usr/local/php/var/log/php-fpm.log
log_level = notice
emergency_restart_threshold = 10
emergency_restart_interval = 1m
process_control_timeout = 5s
daemonize = yes
;pools here
include = /usr/local/php/etc/fpm.d/*.conf
cd fpm.d
cat eric_blog.conf
;
; eric's blog pool
;
[blog]
listen = 127.0.0.1:9000
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
;listen.owner = www
;listen.group = www
;listen.mode = 0666
user = www
group = www
; 有两种形式,static , dynamic 默认是以dynamic。
pm = static
pm.max_children = 50
;pm.start_servers = 20
;pm.min_spare_servers = 5
;pm.max_spare_servers = 35
pm.max_requests = 65535
;pm.status_path = /status
;ping.path = /ping
;ping.response = pong
request_terminate_timeout = 0s
request_slowlog_timeout = 0s
slowlog = /usr/local/php/var/log/php-fpm.log.slow
rlimit_files = 65535
rlimit_core = 0
catch_workers_output = yes
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f
php_flag[display_errors] = off
php_admin_value[error_log] = /usr/local/php/var/log/fpm-php.www.log
php_admin_flag[log_errors] = on
php_admin_value[memory_limit] = 20M
php_admin_value[open_basedir] = /var/www/wordpress:/home/www/sessions:/tmp
php_admin_value[session.save_path] = /home/www/sessions
Php 官方出的 php-fpm 配置文件抛弃了 xml格式,采用 php.ini 格式式样,但是基本的配置是没有变的·其他 nginx 以及 mysql 的安装我就不写了。 创建一个 phpinfo(); 看一下 
 
php-fpm with php-5.3.2 + APC_第1张图片
 
php-fpm with php-5.3.2 + APC_第2张图片