php-fpmwithphp-5.3.2+APC
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(); 看一下
本文轉自Deidara 51CTO部落格,原文連結:http://blog.51cto.com/deidara/317026,如需轉載請自行聯絡原作者