方法一:

yum 安装

默认的版本太低了,手动安装有一些麻烦,想采用Yum安装的可以使用下面的方案:1.检查当前安装的PHP包yumlistinstalled|grepphp如果有安装的PHP包,先删除他们yumremovephp.x86_64php-cli.x86_64php-common.x86_64php-gd.x86_64php-ldap.x86_64php-mbstring.x86_64php-mcrypt.x86_64php-mysql.x86_64php-pdo.x86_642.Centos5.Xrpm-Uvhhttp://mirror.webtatic.com/yum/el5/latest.rpmCentOs6.xrpm-Uvhhttp://mirror.webtatic.com/yum/el6/latest.rpmCentOs7.Xrpm-Uvhrpm-Uvhhttps://mirror.webtatic.com/yum/el7/webtatic-release.rpm如果想删除上面安装的包,重新安装rpm-qa|grepwebstaticrpm-e上面搜索到的包即可3.运行yuminstallyuminstallphp55w.x86_64php55w-cli.x86_64php55w-common.x86_64php55w-gd.x86_64php55w-ldap.x86_64php55w-mbstring.x86_64php55w-mcrypt.x86_64php55w-mysql.x86_64php55w-pdo.x86_64yuminstallphp56w.x86_64php56w-cli.x86_64php56w-common.x86_64php56w-gd.x86_64php56w-ldap.x86_64php56w-mbstring.x86_64php56w-mcrypt.x86_64php56w-mysql.x86_64php56w-pdo.x86_64注:如果想升级到5.6把上面的55w换成56w就可以了。yuminstallphp70w.x86_64php70w-cli.x86_64php70w-common.x86_64php70w-gd.x86_64php70w-ldap.x86_64php70w-mbstring.x86_64php70w-mcrypt.x86_64php70w-mysql.x86_64php70w-pdo.x86_644.安装PHPFPMyuminstallphp55w-fpmyuminstallphp56w-fpmyuminstallphp70w-fpm



方法二:

源码安装:

将之前的源码安装的版本备份为其他的名字mv/usr/local/php//usr/local/php5.3安装libiconvmkdir-p/usr/local/setupcd/usr/local/setupwgettarzxvflibiconv-1.14.tar.gzcdlibiconv-1.14./configure--prefix=/usr/local/libiconvmake&&makeinstallcd..安装libmcryptwgettarzxvflibmcrypt-2.5.8.tar.gzcdlibmcrypt-2.5.8./configuremake&&makeinstallcd..安装mhashtarjxvfmhash-0.9.3.tar.bz2cdmhash-0.9.3./configuremake&&makeinstallcd..安装mcryptwgettarzxvfmcrypt-2.6.8.tar.gzcdmcrypt-2.6.8./configuremake&&makeinstallcd..安装PHP5.5.5wgettarzxvfphp-5.5.5.tar.gzcdphp-5.5.5正式编译,注意安装路径不能与旧版本路径相同./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=mysqlnd--with-mysqli=mysqlnd--with-pdo-mysql=mysqlnd--with-iconv-dir--with-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib--with-libxml-dir=/usr--enable-xml--disable-rpath--enable-magic-quotes--enable-safe-mode--enable-bcmath--enable-shmop--enable-sysvsem--enable-inline-optimization--with-curl--with-curlwrappers--enable-mbregex--enable-mbstring--with-mcrypt--enable-ftp--with-gd--enable-gd-native-ttf--with-openssl--with-mhash--enable-pcntl--enable-sockets--with-xmlrpc--enable-zip--enable-soap--without-pear--with-gettext--disable-fileinfo--enable-maintainer-ztsmake&&makeinstall