在php-fpm.org 网站上已经说明了。
PHP 5.3.3 is released and now bundles PHP-FPM。
告诉我们,在php-5.3.3版本中已经绑定了php-fpm 所以,再编译这个版本的时候不需要做打php-fpm补丁的操作了。
下面我就把如何编译并配置php-5.3.3 的步骤写出来,分享给大家。
1 wget php-5.3.3.tar.gz
2 tar zxvf php-5.3.3.tar.gz
3 cd php-5.3.3
4 './configure' '--prefix=/usr/local/php' '--with-config-file-path=/usr/local/php/etc' '--enable-fpm' '--with-fpm-user=www' '--with-fpm-group=www' '--with-mysql=/usr/local/mysql' '--with-mysql-sock=/tmp' '--with-libxml-dir' '--with-gd' '--with-jpeg-dir' '--with-png-dir' '--with-freetype-dir' '--with-iconv-dir' '--with-zlib-dir' '--with-mcrypt' '--enable-soap' '--enable-gd-native-ttf' '--enable-ftp' '--enable-mbstring' '--enable-exif' '--enable-zend-multibyte' '--disable-ipv6' '--enable-fastcgi' '--with-pear' '--with-curl' '--with-openssl'
5 make && make install
注:如果在以上步骤中,提示找不到libevent 等错误时,那说明你还没有安装libevent这个库,所以需要手动安装一下。可以用yum install -y libevent 这个命令搞定。
如果你顺利执行完以上5步,那么你已经安装好了php-5.3.3
接下来就是需要配置了。
cp /usr/local/src/php-5.3.3/php.ini-development /usr/local/php/etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
vi /usr/local/php/etc/php-fpm.conf
需要修改的地方为:
[global]
pid = /usr/local/php/var/run/php-fpm.pid
error_log = /usr/local/php/var/log/php-fpm.log
[www]
listen = /tmp/php-fcgi.sock
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
rlimit_files = 1024
这些地方需要删除行开头的分号。
启动php-fpm
命令为 /usr/local/php/sbin/php-fpm -c /usr/local/php/etc/php.ini -y /usr/local/php/etc/php-fpm.conf
你也可以使用系统启动脚本
cp /usr/local/src/php-5.3.3/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod 755 /etc/init.d/php-fpm
/etc/init.d/php-fpm start
注:从php-5.3版本起,mysql的驱动已经支持了mysqlnd,据说这个驱动有效减少了内存使用。具体请看 http://www.lishiming.net/thread-408-1-1.html
PHP 5.3.3 is released and now bundles PHP-FPM。
告诉我们,在php-5.3.3版本中已经绑定了php-fpm 所以,再编译这个版本的时候不需要做打php-fpm补丁的操作了。
下面我就把如何编译并配置php-5.3.3 的步骤写出来,分享给大家。
1 wget php-5.3.3.tar.gz
2 tar zxvf php-5.3.3.tar.gz
3 cd php-5.3.3
4 './configure' '--prefix=/usr/local/php' '--with-config-file-path=/usr/local/php/etc' '--enable-fpm' '--with-fpm-user=www' '--with-fpm-group=www' '--with-mysql=/usr/local/mysql' '--with-mysql-sock=/tmp' '--with-libxml-dir' '--with-gd' '--with-jpeg-dir' '--with-png-dir' '--with-freetype-dir' '--with-iconv-dir' '--with-zlib-dir' '--with-mcrypt' '--enable-soap' '--enable-gd-native-ttf' '--enable-ftp' '--enable-mbstring' '--enable-exif' '--enable-zend-multibyte' '--disable-ipv6' '--enable-fastcgi' '--with-pear' '--with-curl' '--with-openssl'
5 make && make install
注:如果在以上步骤中,提示找不到libevent 等错误时,那说明你还没有安装libevent这个库,所以需要手动安装一下。可以用yum install -y libevent 这个命令搞定。
如果你顺利执行完以上5步,那么你已经安装好了php-5.3.3
接下来就是需要配置了。
cp /usr/local/src/php-5.3.3/php.ini-development /usr/local/php/etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
vi /usr/local/php/etc/php-fpm.conf
需要修改的地方为:
[global]
pid = /usr/local/php/var/run/php-fpm.pid
error_log = /usr/local/php/var/log/php-fpm.log
[www]
listen = /tmp/php-fcgi.sock
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
rlimit_files = 1024
这些地方需要删除行开头的分号。
启动php-fpm
命令为 /usr/local/php/sbin/php-fpm -c /usr/local/php/etc/php.ini -y /usr/local/php/etc/php-fpm.conf
你也可以使用系统启动脚本
cp /usr/local/src/php-5.3.3/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod 755 /etc/init.d/php-fpm
/etc/init.d/php-fpm start
注:从php-5.3版本起,mysql的驱动已经支持了mysqlnd,据说这个驱动有效减少了内存使用。具体请看 http://www.lishiming.net/thread-408-1-1.html
0
本帖最后由 lqph3387 于 2010-11-26 13:37 编辑
楼主这么好,这么快就分享了,我把我的安装步骤也贴一下:lol
下载php5.3.3
[root@localhost]# wget http://cn2.php.net/get/php-5.3 ... irror
-----------------------------------------------------------------------------------
安装php5.3.3
[root@localhost]# tar zxvf php-5.3.3.tar.gz
[root@localhost]# cd php-5.3.3
[root@localhost]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-libevent-dir --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-mcrypt --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --enable-zend-multibyte --disable-ipv6
[root@localhost]# make
[root@localhost]# make install
[root@localhost]# cp /usr/local/src/php-5.3.3/php.ini-production /usr/local/php/etc/php.ini
[root@localhost]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
------------------------------------------------------------------------
优化fpm参数:
[root@localhost]# vim /usr/local/php/etc/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
[www]
listen = /tmp/php-fcgi.sock
user = www
group = www
pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
------------------------------------------------------------------------
设置fpm开机自启动:
[root@localhost]# cp /usr/local/src/php-5.3.3/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@localhost]# chmod 755 /etc/init.d/php-fpm
[root@localhost]# /etc/init.d/php-fpm start
[root@localhost]# ps -ef|grep fpm
楼主这么好,这么快就分享了,我把我的安装步骤也贴一下:lol
下载php5.3.3
[root@localhost]# wget http://cn2.php.net/get/php-5.3 ... irror
-----------------------------------------------------------------------------------
安装php5.3.3
[root@localhost]# tar zxvf php-5.3.3.tar.gz
[root@localhost]# cd php-5.3.3
[root@localhost]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-libevent-dir --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-mcrypt --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --enable-zend-multibyte --disable-ipv6
[root@localhost]# make
[root@localhost]# make install
[root@localhost]# cp /usr/local/src/php-5.3.3/php.ini-production /usr/local/php/etc/php.ini
[root@localhost]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
------------------------------------------------------------------------
优化fpm参数:
[root@localhost]# vim /usr/local/php/etc/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
[www]
listen = /tmp/php-fcgi.sock
user = www
group = www
pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
------------------------------------------------------------------------
设置fpm开机自启动:
[root@localhost]# cp /usr/local/src/php-5.3.3/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@localhost]# chmod 755 /etc/init.d/php-fpm
[root@localhost]# /etc/init.d/php-fpm start
[root@localhost]# ps -ef|grep fpm
编辑回复