Centos 6/7下 yum安装或升级到php7

在centos6/7中使用yum安装PHP默认是5.*的版本,今天和大家分享一下如何安装php7。

在安装php7之前先要将旧版本删除

yum remove php* php-common

rpm 安装 Php7 相应的 yum源

CentOS/RHEL 7.x:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

CentOS/RHEL 6.x:

rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

yum安装php7

yum install php70w php70w-opcache

安装相关依赖包

yum install php70w.x86_64 php70w-bcmath.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-dba.x86_64 php70w-devel.x86_64 php70w-embedded.x86_64 php70w-enchant.x86_64 php70w-fpm.x86_64 php70w-gd.x86_64 php70w-imap.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysqlnd.x86_64 php70w-odbc.x86_64 php70w-opcache.x86_64 php70w-pdo.x86_64 php70w-pdo_dblib.x86_64 php70w-pear.noarch php70w-pecl-apcu.x86_64 php70w-pecl-apcu-devel.x86_64 php70w-pecl-imagick.x86_64 php70w-pecl-imagick-devel.x86_64 php70w-pecl-mongodb.x86_64 php70w-pecl-redis.x86_64 php70w-pecl-xdebug.x86_64 php70w-pgsql.x86_64 php70w-xml.x86_64 php70w-xmlrpc.x86_64 nginx php70w-intl -y

重启 Apache

service httpd restart   //centos6
systemctl restart httpd //centos7

 

你可能感兴趣的:(centos,PHP)