centos7.2yum安装php70w.x86_64

一、查看centos版本

[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core) 

二、删除之前的 php 版本

如果是第一次安装省略...

[root@localhost ~]# yum remove php* php-common   

三、rpm 安装 Php7 相应的 yum源

[root@localhost ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm     

注意:如果报错,以下是报错信息:

Retrieving https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
warning: /var/tmp/rpm-tmp.o0rIru: Header V4 RSA/SHA1 Signature, key ID 62e74ca5: NOKEY
error: Failed dependencies:
	epel-release >= 7 is needed by webtatic-release-7-3.noarch

在安装包后面加两个参数,如

[root@localhost ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm --nodeps --force

加上那两个参数的意义就在于,
安装时不再分析包之间的依赖关系而直接安装,
也就不会再提示error: Failed dependencies:这样的错误了
正确返回:

Retrieving https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
warning: /var/tmp/rpm-tmp.0nuQEZ: Header V4 RSA/SHA1 Signature, key ID 62e74ca5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:webtatic-release-7-3             ################################# [100%]

四、直接yum安装php7

现在可以直接yum安装php7

[root@localhost ~]# yum install php70w

一路“y”
最后成功返回:

....
Installed:
  php70w.x86_64 0:7.0.10-1.w7                                                   

Dependency Installed:
  apr.x86_64 0:1.4.8-3.el7                                                      
  apr-util.x86_64 0:1.5.2-6.el7                                                 
  httpd.x86_64 0:2.4.6-40.el7.centos.4                                          
  httpd-tools.x86_64 0:2.4.6-40.el7.centos.4                                    
  mailcap.noarch 0:2.1.41-2.el7                                                 
  php70w-cli.x86_64 0:7.0.10-1.w7                                               
  php70w-common.x86_64 0:7.0.10-1.w7                                            

Complete!

五、检查 php 版本

[root@localhost ~]# php -v 

返回:

PHP 7.0.10 (cli) (built: Aug 20 2016 07:47:25) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

5、重启 Apache或Nginx,查看 phpinfo :

Apache:

[root@localhost ~]# systemctl restart httpd.service

ngingx:

[root@localhost ~]# systemctl restart nginx.service

发布日期:

所属分类: 手游单机 标签:  


没有相关文章!