在centos7通过yum安装PHP7,首先在终端运行:
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
提示错误:
error: Failed dependencies:
epel-release >= 7 is needed by webtatic-release-7-3.noarch
需要先安装epel-release。
1.安装epel-release
通过命令:
rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
成功安装。
2.安装PHP7
终端再次运行如下命令:
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
成功获取PHP7的yum源,然后再执行:
yum install php70w
这样就大功告成了。
3.验证安装
终端命令:php -v,显示当前PHP版本,信息如下:
[root@iZ94w0kemvtZ /]# php -v
PHP 7.0.2 (cli) (built: Jan 9 2016 14:00:11) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
这样就在CentOS 7下通过yum安装成功PHP7.