PHP5-Curl安装错误,找不到安装候选项。

9
我想在我的Debian服务器上安装PHP5-Curl。但是当我运行以下命令时:
apt-get install PHP5-Curl

我遇到了以下错误:

Reading package lists... Done
Building dependency tree
Reading state information... Done

Package PHP5-Curl is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package 'PHP5-Curl' has no installation candidate

这可能是由于版本混合造成的。请先检查您配置的存储库中是否有可用的php5-curl包。如果有,请检查您的php5包的版本,它们应该都来自同一个存储库。 - arkascha
你可以准确地说出我能做什么吗? - bitcodr
你添加了代码库吗? - orvi
2
sudo add-apt-repository ppa:ondrej/php5 - orvi
啊 :(,显示“-bash:add-apt-repository:命令未找到” - bitcodr
这更多是一个系统管理员的问题,而不是一个编程/PHP问题。 - Dalibor Karlović
4个回答

15
使用sudo apt-get install php5.6-curl

12

您可以使用命令 sudo apt-cache search curl | grep php搜索适合您的可用版本,然后使用命令sudo apt-get install php<x>-curl进行安装。

在我的情况下,需要安装php7.0-curl版本。


1
这实际上是正确答案,而不是上面的那个(https://dev59.com/yJLea4cB1Zd3GeqP4p-Y#42048947)。 5.6已经过时,7.0也是如此。这个解决方案让我能够找到正确的值7.2,我相信在未来几个月中这个值会改变。 - Rylan Schaeffer
这对我真的很有用,我已经安装了Curl 7.2,但仍在运行PHP 5.6。所以我将我的php升级到7.2,问题解决了。谢谢..... - Kiryamwibo Yenusu
谢谢!我认为这应该是被采纳的答案。 - iconique
谢谢!别忘了在此之后执行“sudo service apache2 restart” :D - Tarik Hacialiogullari

1

首先使用命令 php -v 搜索您的php版本,然后下载相应版本的php(版本)-curl。


-5

看起来您安装了多个冲突的 PHP 版本。首先,让我们清理一下。在删除之前,请先备份您的配置文件。

dpkg --purge --force-all php5-curl
apt-get remove php5-*
apt-get purge php5-*
apt-get autoremove

现在,再次运行dpkg -l | grep php5,确保没有安装任何php5-...包。

然后,让我们重新开始:

apt-get install php5-cli php5-curl

如果您需要Apache模块:
apt-get install libapache2-mod-php5

或者如果您需要 FPM 模块:

apt-get install php5-fpm

apt-cache rdepends PHP5-Curl 给你什么信息? - Will
你可以从原帖发布的信息中看到,apt-get 正确处理了这些情况。 - arkascha
好的,现在试试看!如果你发现任何问题或错误,请发布它们。 - Will
谢谢您的回答。但是我运行这个命令 dpkg --purge --force-all php5-curl,显示 dpkg: warning: ignoring request to remove php5-curl which isn't installed。当我运行 apt-get remove php5-* 时,我得到相同的错误。 - bitcodr
让我们在聊天室继续这个讨论:http://chat.stackoverflow.com/rooms/99585/discussion-between-will-and-amirali-roshanaei - Will
显示剩余6条评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接