尝试安装现已可用的 PHP 7;
(在 CentOS 7 上)
添加了 repo:
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
Then installed via:
yum install php70w php70w-opcache
输出为:
[root@host]# yum install php70w php70w-opcache
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.advancedhosters.com
* epel: mirror.symnds.com
* extras: mirror.netdepot.com
* updates: mirrors.rit.edu
* webtatic: us-east.repo.webtatic.com
Resolving Dependencies
--> Running transaction check
---> Package php70w.x86_64 0:7.0.2-1.w7 will be installed
--> Processing Dependency: php70w-common(x86-64) = 7.0.2-1.w7 for package: php70w-7.0.2-1.w7.x86_64
--> Processing Dependency: php70w-cli(x86-64) = 7.0.2-1.w7 for package: php70w-7.0.2-1.w7.x86_64
--> Processing Dependency: php70w-cli = 7.0.2-1.w7 for package: php70w-7.0.2-1.w7.x86_64
---> Package php70w-opcache.x86_64 0:7.0.2-1.w7 will be installed
--> Running transaction check
---> Package php70w-cli.x86_64 0:7.0.2-1.w7 will be installed
---> Package php70w-common.x86_64 0:7.0.2-1.w7 will be installed
--> Processing Conflict: php70w-common-7.0.2-1.w7.x86_64 conflicts php-common < 5.5.0
--> Finished Dependency Resolution
Error: php70w-common conflicts with php-common-5.4.16-36.el7_1.x86_64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
所以问题是:Error: php70w-common conflicts with php-common-5.4.16-36.el7_1.x86_64
如何修复这个问题?我需要同时运行两个版本。
答案1
答案2
我认为这不是好方法。如果一台服务器上有多个不同的 PHP 版本,配置和编程会非常繁琐。如果你有单独的服务器,那就容易多了。另外,为什么需要两者?PHP 5 应用程序与 PHP 7 几乎兼容……如果它们使用 mysql_connect 而不是 mysqli
答案3
您可以运行以下命令
yum --skip-broken install (package_name)
它将安装所有依赖项并跳过冲突的包。