安装nginx +php-fpm
安装pcre-8.00.tar.gz
cd pcre-8.00
./configure && make && make install
安装nginx
tar xzvf nginx.tar.gz
./configure --prefix=/usr/local/nginx --with-http_stub_status_module
make && make install
编译安装 libpng、zlib、freetype、jpeg、gd
安装libiconv
tar xzvf libiconv-1.13.1.tgz
cd libiconv-1.13.1
./configure && make && make install
安装libevent
tar xzvf libevent-1.4.13.tar.gz
cd libevent-1.4.13
./configure --enable-shared
make && make install
编译安装autoconf-2.13,特别注意:php-fpm的编译只能用这个版本的,高版本的不行
export WANT_AUTOCONF=2.1
wget
tar xfz autoconf-2.13.tar.gz
cd autoconf-2.13
./configure
make
make install
cd ../
也可以试试修改环境变量
export WANT_AUTOCONF=2.1
编译安装php-5.3.2和php-fpm
export PHP_AUTOCONF=/usr/local/bin/autoconf
export PHP_AUTOHEADER=/usr/local/bin/autoheader
wget
tar xfj php-5.3.2.tar.bz2
cd php-5.3.2
svn co sapi/fpm
./buildconf --force
./configure --prefix=/usr/local/php5 --enable-fpm --with-mysql --with-gd --with-zlib-dir=/usr/local/lib --with-png-dir=/usr/local/lib --with-jpeg-dir=/usr/local/lib --with-freetype-dir=/usr/local/lib --with-iconv-dir=/usr/local/libiconv --enable-sockets --with-curl --without-sqlite --enable-gd-native-ttf --enable-xml
php编译make提示:
ext/iconv/iconv.o:/root/php-5.2.6/ext/iconv/iconv.c:2537: more undefined references to `libiconv’ follow
ext/iconv/iconv.o: In function `php_iconv_stream_filter_ctor’:
/root/php-5.2.6/ext/iconv/iconv.c:2491: undefined reference to `libiconv_open’
collect2: ld returned 1 exit status
make: *** [sapi/cgi/php-cgi] Error 1
处理方法:
編輯 Makefile 寻找下面修改
EXTRA_LIBS = ….. -lcrypt
在最後加上 -liconv,例如:
EXTRA_LIBS = ….. -lcrypt -liconv
make
make install
cp php.ini-production /usr/local/php/etc/php.ini
cp sapi/fpm/init.d.php-fpm.in /etc/init.d/php-fpm
chmod 755 /etc/init.d/php-fpm
cp /var/ftp/pub/php5/sapi/fpm/php-fpm.conf.in php-fpm.conf
3.1 配置php-fpm
cat php-fpm.conf;;
Global;
pid = /usr/local/php/var/run/php-fpm.pid
error_log = /usr/local/php5/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/php5/etc/fpm.d/*.conf
[www]
listen = 127.0.0.1:9000
listen.backlog = -1
listen.allowed_clients = 127.0.0.1;
listen.owner = daemon;
listen.group = daemon;
listen.mode = 0666
user = www
group = www
有两种形式,static , dynamic 默认是以dynamic。
pm = static
pm.max_children = 20;
pm.start_servers = 5;
pm.min_spare_servers = 5;
pm.max_spare_servers = 10
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
阅读(1155) | 评论(0) | 转发(0) |