centos安装新PHP版本

前端之家收集整理的这篇文章主要介绍了centos安装新PHP版本前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

方法一:

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_64
2.Centos5.Xrpm-Uvhhttp://mirror.webtatic.com/yum/el5/latest.rpm
CentOs6.xrpm-Uvhhttp://mirror.webtatic.com/yum/el6/latest.rpm
CentOs7.Xrpm-Uvh
rpm-Uvhhttps://mirror.webtatic.com/yum/el7/webtatic-release.rpm
如果想删除上面安装的包,重新安装
rpm-qa|grepwebstatic
rpm-e上面搜索到的包即可
3.运行yuminstall
yuminstallPHP55w.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_64
yuminstallPHP56w.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_64
4.安装PHPFPM
yuminstallPHP55w-fpm
yuminstallPHP56w-fpm
yuminstallPHP70w-fpm



方法二:

源码安装:

将之前的源码安装的版本备份为其他的名字
mv/usr/local/PHP//usr/local/PHP5.3
安装libiconv
mkdir-p/usr/local/setupcd/usr/local/setup
wget
tarzxvflibiconv-1.14.tar.gz
cdlibiconv-1.14
./configure--prefix=/usr/local/libiconv
make&&makeinstall
cd..
安装libmcrypt
wget
tarzxvflibmcrypt-2.5.8.tar.gzcdlibmcrypt-2.5.8
./configuremake&&makeinstall
cd..
安装mhash
tarjxvfmhash-0.9.3.tar.bz2
cdmhash-0.9.3
./configure
make&&makeinstall
cd..
安装mcrypt
wget
tarzxvfmcrypt-2.6.8.tar.gzcdmcrypt-2.6.8
./configuremake&&makeinstall
cd..
安装PHP5.5.5
wget
tarzxvfPHP-5.5.5.tar.gz
cdPHP-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-zts
make&&makeinstall

猜你在找的CentOS相关文章