安装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源。则修改yum的源为阿里云的源。如下 :
阿里去源地址为:http://mirrors.aliyun.com/repo/
下载相应的源如下:
我这里系统是Centos7所以下载相应的Centos7的源。
centOS7的源路径为:# /etc/yum.repos.d/
路径下有以上文件,删除以上所有文件 ,将下载的阿里云的文件拷贝到此目录下(/etc/yum.repos.d/).
然后执行如下命令:
# yum clean all;
#yum makecache;
执行完成 后继续执行:
centos7执行:
# 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 //如果执行此条命令失败,则再执行一次clean all ,makecache。
centos6执行:
# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
这里发现正常执行,正常下载相应的php源。
通过命令:
yum search php7
查看php7的版本信息。
安装php7
# yum install mod_php71w php71w-opcache php71w-fpm
安装php7扩展:
# yum install php71w-gd php71w-mbstring php71w-pecl-redis php71w-pgsql
到此php7安装成功。