简体   繁体   English

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

[英]Error Installing php-devel on centos 6.5 and php 5.4

Server is running Centos 6.5 with PHP 5.4.40. 服务器正在使用PHP 5.4.40运行Centos 6.5。

Entering: 输入:

yum install php-devel

Results in the following: 结果如下:

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

Another user on SO had the issue when running 5.3, tried variations of their recommendations with no luck. SO上的另一个用户在运行5.3时遇到了问题,尝试了各种建议,但没有运气。 The last two lines of the error make to recommendations but don't want try random commands that may negatively impact the server. 错误的最后两行提出了建议,但不想尝试可能对服务器造成负面影响的随机命令。 Any ideas or more information I can provide? 我可以提供任何想法或更多信息吗?

To note, ultimately trying to install SSH2 but requires php-devel. 注意,最终尝试安装SSH2,但需要php-devel。

You need to uninstall all of PHP 5.3. 您需要卸载所有PHP 5.3。

sudo yum erase php-common

Should remove all the PHP-5.3 packages. 应该删除所有PHP-5.3软件包。

You need to install php-devel by using this command: 您需要使用以下命令安装php-devel:

for normal user 对于普通用户

$ sudo yum install php54w-devel $ sudo yum install php54w-devel

for root user 对于root用户

$ yum install php54w-devel $百胜安装php54w-devel

You see this error due to your php version. 由于您的php版本,您会看到此错误。 I also faced same issue and I tried these code and it works for me. 我也遇到了同样的问题,我尝试了这些代码,它对我有用。

You can go to /etc/yum.repos.d. 您可以转到/etc/yum.repos.d。 and remove the extra repository that you can see in your error message. 并删除您在错误消息中看到的额外存储库。

If that doesnt work, try removing php by 如果这样不起作用,请尝试通过以下方式删除php

yum remove php-common-5.3.3-46.el6_6.x86_64

Your packages are conflicting Error: php54w-common conflicts with php-common-5.3.3-46.el6_6.x86_64 您的软件包存在冲突Error: php54w-common conflicts with php-common-5.3.3-46.el6_6.x86_64

Based off this forum post and the comments above running rpm -qa | grep -i php 基于此论坛帖子以及上面运行rpm -qa | grep -i php的评论rpm -qa | grep -i php rpm -qa | grep -i php will show you which packages are installed so you can determine if 5.3 is safe to uninstall. rpm -qa | grep -i php将显示安装了哪些软件包,以便您确定5.3是否可以安全卸载。 Other tutorials have recommended yum list installed | grep php 其他教程推荐yum list installed | grep php yum list installed | grep php as well. yum list installed | grep php也是如此。

If you're concerned about a production server (comments about production upgrades aside) then double check the PHP FPM and/or Apache2/nginx config too to check which PHP binaries/runtime are running the site (is it 5.4 or 5.3) before making any changes. 如果您担心生产服务器(不包括有关生产升级的注释),则在制作之前,还要仔细检查PHP FPM和/或Apache2 / nginx配置,以检查哪个PHP二进制文件/运行时正在运行站点(是5.4还是5.3)。任何变化。

If you're trying to upgrade PHP 如果您要升级PHP

To resolve the conflict, simply remove the offending package (in this case 5.3), with yum remove php-common-5.3.3-46.el6_6.x86_64 before re-attempting the 5.5 install. 要解决冲突,只需删除有问题的软件包(在本例中为5.3),然后使用yum remove php-common-5.3.3-46.el6_6.x86_64然后再尝试进行5.5安装。 Assuming your WordPress site is updated and plugins too then it should be 5.4 compat (at least from the past few years anyway). 假设您的WordPress网站已更新并且插件也是如此,那么它应该是5.4兼容(至少无论如何从过去几年开始)。

If you're trying to add php-devel to build an extension for 5.4 如果您尝试添加php-devel为5.4扩展

Since you mentioned the server is reporting its 5.4 (despite having 5.3 still installed too) then you might need to follow this SO's advice and enable the devel repo for 5.4: yum --enablerepo=remi,remi-php54 install php-devel 既然您提到服务器正在报告其5.4(尽管仍然安装了5.3),那么您可能需要遵循建议,并启用5.4的开发yum --enablerepo=remi,remi-php54 install php-develyum --enablerepo=remi,remi-php54 install php-devel

You should run: 您应该运行:

yum install php54w-devel

So when install php-extension have error: 因此,当安装php-extension出现错误:

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

Just type *-extension 只需输入*-extension

Example: 例:

yum install php-fpm have error yum install php-fpm有错误

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

then you should run 那你应该跑

yum install php56u-fpm

The reason of this error is you install a php version don't match the system repo version. 发生此错误的原因是您安装的php版本与系统存储库版本不匹配。 So yum get a version of the system repo, but this don't compatible with the php version you have installed. 因此,您会获得系统回购的版本,但这与您已安装的php版本不兼容。 When you specific the php version, yum get the right version, so happy! 当您指定php版本时,yum获得了正确的版本,太高兴了!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM