在centos 6.5和php 5.4上安装php-devel时出错

时间:2015-10-19 20:24:47

标签: php centos6.5

服务器运行带有PHP 5.4.40的Centos 6.5。

输入:

yum install php-devel

结果如下:

Loaded plugins: fastestmirror, refresh-packagekit, replace, security
Loading mirror speeds from cached hostfile
 * base: mirror.tngwebhost.com
 * epel: fedora.westmancom.com
 * extras: mirror.tocici.com
 * updates: mirror.oss.ou.edu
 * webtatic: uk.repo.webtatic.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php-devel.x86_64 0:5.3.3-46.el6_6 will be installed
--> Processing Dependency: php(x86-64) = 5.3.3-46.el6_6 for package: php-devel-5.3.3-46.el6_6.x86_64
--> Running transaction check
---> Package php.x86_64 0:5.3.3-46.el6_6 will be installed
--> Processing Dependency: php-common(x86-64) = 5.3.3-46.el6_6 for package: php-5.3.3-46.el6_6.x86_64
--> Processing Dependency: php-cli(x86-64) = 5.3.3-46.el6_6 for package: php-5.3.3-46.el6_6.x86_64
--> Running transaction check
---> Package php-cli.x86_64 0:5.3.3-46.el6_6 will be installed
---> Package php-common.x86_64 0:5.3.3-46.el6_6 will be installed
--> Processing Conflict: php54w-common-5.4.40-1.w6.x86_64 conflicts php-common < 5.4.0
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package php54w-common.x86_64 0:5.4.40-1.w6 will be updated
--> Processing Dependency: php54w-common(x86-64) = 5.4.40-1.w6 for package: php54w-mbstring-5.4.40-1.w6.x86_64
--> Processing Dependency: php54w-common(x86-64) = 5.4.40-1.w6 for package: php54w-gd-5.4.40-1.w6.x86_64
--> Processing Dependency: php54w-common(x86-64) = 5.4.40-1.w6 for package: php54w-pdo-5.4.40-1.w6.x86_64
--> Processing Dependency: php54w-common(x86-64) = 5.4.40-1.w6 for package: php54w-5.4.40-1.w6.x86_64
--> Processing Dependency: php54w-common(x86-64) = 5.4.40-1.w6 for package: php54w-cli-5.4.40-1.w6.x86_64
--> Processing Dependency: php54w-common(x86-64) = 5.4.40-1.w6 for package: php54w-xml-5.4.40-1.w6.x86_64
--> Processing Dependency: php54w-common(x86-64) = 5.4.40-1.w6 for package: php54w-dba-5.4.40-1.w6.x86_64
--> Processing Dependency: php54w-common(x86-64) = 5.4.40-1.w6 for package: php54w-bcmath-5.4.40-1.w6.x86_64
---> Package php54w-common.x86_64 0:5.4.45-1.w6 will be an update
--> Running transaction check
---> Package php54w.x86_64 0:5.4.40-1.w6 will be updated
---> Package php54w.x86_64 0:5.4.45-1.w6 will be an update
---> Package php54w-bcmath.x86_64 0:5.4.40-1.w6 will be updated
---> Package php54w-bcmath.x86_64 0:5.4.45-1.w6 will be an update
---> Package php54w-cli.x86_64 0:5.4.40-1.w6 will be updated
---> Package php54w-cli.x86_64 0:5.4.45-1.w6 will be an update
---> Package php54w-dba.x86_64 0:5.4.40-1.w6 will be updated
---> Package php54w-dba.x86_64 0:5.4.45-1.w6 will be an update
---> Package php54w-gd.x86_64 0:5.4.40-1.w6 will be updated
---> Package php54w-gd.x86_64 0:5.4.45-1.w6 will be an update
---> Package php54w-mbstring.x86_64 0:5.4.40-1.w6 will be updated
---> Package php54w-mbstring.x86_64 0:5.4.45-1.w6 will be an update
---> Package php54w-pdo.x86_64 0:5.4.40-1.w6 will be updated
---> Package php54w-pdo.x86_64 0:5.4.45-1.w6 will be an update
---> Package php54w-xml.x86_64 0:5.4.40-1.w6 will be updated
---> Package php54w-xml.x86_64 0:5.4.45-1.w6 will be an update
--> Processing Conflict: php54w-common-5.4.45-1.w6.x86_64 conflicts php-common < 5.4.0
--> Finished Dependency Resolution
Error: php54w-common conflicts with php-common-5.3.3-46.el6_6.x86_64
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

SO上的另一个用户在运行5.3时遇到了问题,尝试了他们推荐的变体而没有运气。错误的最后两行是建议但不想尝试可能对服务器产生负面影响的随机命令。我可以提供任何想法或更多信息吗?

要注意,最终尝试安装SSH2但需要php-devel。

5 个答案:

答案 0 :(得分:1)

您需要卸载所有PHP 5.3。

sudo yum erase php-common

应该删除所有PHP-5.3包。

答案 1 :(得分:1)

您需要使用以下命令安装php-devel:

普通用户

  

$ sudo yum install php54w-devel

用户

  

$ yum install php54w-devel

由于您的php版本,您会看到此错误。我也面临同样的问题,我尝试了这些代码,它对我有用。

答案 2 :(得分:0)

你可以去/etc/yum.repos.d。并删除您可以在错误消息中看到的额外存储库。

如果这不起作用,请尝试通过

删除php

var Promise = require("bluebird"); Promise.promisifyAll(require("restify")); var restify = require("restify"); var http = require('http'); const PORT=7070; function handleRequest(request, response){ response.end('It Works!! Path Hit: ' + request.url); } var server = http.createServer(handleRequest); server.listen(PORT, function(){ console.log("Server listening on: http://localhost:%s", PORT); }); var client = restify.createJsonClientAsync({ url: 'http://127.0.0.1:7070' }); client.get("/foo").spread(function(req, res, obj) { console.log(obj); });

答案 3 :(得分:0)

您的包裹存在冲突 Error: php54w-common conflicts with php-common-5.3.3-46.el6_6.x86_64

基于this forum post并且上面运行rpm -qa | grep -i php的评论将显示您安装了哪些软件包,以便确定5.3是否可以安全卸载。其他教程也推荐yum list installed | grep php

如果您担心生产服务器(关于生产升级的评论除外),那么请仔细检查PHP FPM和/或Apache2 / nginx配置,以检查哪些PHP二进制文件/运行时正在运行该站点(是5.4还是5.3) )在做出任何改变之前。

如果您正在尝试升级PHP

要解决冲突,只需在重新尝试5.5安装之前,使用yum remove php-common-5.3.3-46.el6_6.x86_64删除有问题的包(在本例中为5.3)。假设您的WordPress网站已更新并插件也应该是5.4 compat(至少从过去几年开始)。

如果您尝试添加php-devel以构建5.4的扩展程序

由于您提到服务器正在报告其5.4(尽管仍然安装了5.3),您可能需要遵循this SO's建议并启用5.4版的devel repo:yum --enablerepo=remi,remi-php54 install php-devel

答案 4 :(得分:0)

你应该跑:

yum install php54w-devel

因此,当安装php-extension出错时:

*-common conflicts with php-common-5.3.3-46.el6_6.x86_64

只需输入*-extension

即可

示例:

yum install php-fpm有错误

Error: php56u-common conflicts with php-common-5.3.3-46.el6_7.1.x86_64

然后你应该运行

yum install php56u-fpm

出现此错误的原因是您安装的php版本与系统仓库版本不匹配。因此,yum获得了系统仓库的版本,但这与您安装的php版本不兼容。当你具体的php版本时,yum得到了正确的版本,非常高兴!