./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
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
错误解决:
1、cannot find openSSL`s<evp.h>
yum install openssl openssl-devel
2、mcryot.h not found
yum install epel-release //扩展包更新包
yum update //更新yum源
yum install libmcrypt libmcrypt-devel mcrypt mhash 就ok了
3、 jpeglib.h not found.
yum install jpeglib jpeglib-devel
4、png.h not found
yum install libpng libpng-devel
5、freetype-config not found.
yum install -y freetype freetype-devel
原文:http://www.cnblogs.com/baiquan/p/6098669.html