在安装PHP之前,为满足大多数应用场景,可以先安装以下插件:
yum -y install libxml2-devel
yum -y install curl-devel
yum -y install libpng-devel
cd /usr/src/php
wget http://museum.php.net/php5/php-5.5.0.tar.gz
tar -zxvf php-5.5.0.tar.gz
cd php-5.5.0
#配置下PHP的编译参数
./configure --prefix=/usr/local/php --with-mysql --with-mysqli --with-iconv-dir --with-zlib --with-libxml-dir=/usr/local/libxml2 --enable-xml --with-curl --enable-fpm --enable-mbstring --with-gd --with-openssl --with-mhash --enable-sockets --with-xmlrpc --enable-zip --enable-soap
继续安装:
make
make install clean
#复制php.ini
cp php.ini-development /usr/local/php/lib/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
#使用php-fpm
/usr/local/php/sbin/php-fpm