0%

Centos7下php5.4升级php7的方法

直接通过yum包管理器安装
yum install php70
发现报错

Loaded plugins: fastestmirror  
Loading mirror speeds from cached hostfile
* webtatic: us-east.repo.webtatic.com
Resolving Dependencies
--> Running transaction check
---> Package php56w-gd.x86_64 0:5.6.32-1.w7 will be installed
--> Processing Dependency: php56w-common(x86-64) = 5.6.32-1.w7 for package: php56w- gd-5.6.32-1.w7.x86_64
--> Running transaction check
---> Package php56w-common.x86_64 0:5.6.32-1.w7 will be installed
--> Processing Conflict: php56w-common-5.6.32-1.w7.x86_64 conflicts php-common < 5.6
--> Finished Dependency Resolution
Error: php56w-common conflicts with php-common-5.4.16-43.el7_4.x86_64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
```
<!-- more -->

发现版本冲突,列出php相关的所有包
` yum list installed | grep php`
显示:

php-cli.x86_64 5.4.16-43.el7_4 @updates
php-common.x86_64 5.4.16-43.el7_4 @updates
php-gd.x86_64 5.4.16-43.el7_4 @updates
php-imap.x86_64 5.4.16-7.el7 @epel
php-ldap.x86_64 5.4.16-43.el7_4 @updates

一一删除之  
`yum remove php-cli.x86_64 `
`...`

重新安装
`yum install php70`
完成

~ php -v
PHP 7.0.25 (cli) (built: Oct 29 2017 13:43:03) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
```

Disqus评论区没有正常加载,请使用科学上网