wget http://cn2.php.net/distributions/php-5.4.37.tar.bz2
tar jxf php-5.4.37.tar.bz2
useradd -s /sbin/nologin php-fpm
cd php-5.4.37
./configure --prefix=/usr/local/php
--with-config-file-path=/usr/local/php/etc --enable-fpm
--with-fpm-user=php-fpm --with-fpm-group=php-fpm
--with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --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 --disable-ipv6
--with-curl
make && make install
cp php.ini-production /usr/local/php/etc/php.ini
拷贝启动脚本:
cp /usr/local/src/php-5.4.37/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
mv /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
chmod 755 /etc/init.d/php-fpm
chkconfig --add php-fpm
service php-fpm start
chkconfig php-fpm on
编译错误:
错误7
报错内容:configure: error: mcrypt.h not found. Pleasereinstall libmcrypt
centos源不能安装libmcrypt-devel,由于版权的原因没有自带mcrypt的包
有两种方法解决,一种是使用第三方源,这样还可以使用yum来安装,简单方便,坏处是第三方源多少有中不可靠的感觉。
解决办法一
1、安装第三方yum源
wget http://www.atomicorp.com/installers/atomic
sh ./atomic
2、使用yum命令安装
yum install php-mcrypt libmcrypt libmcrypt-devel