如何在Linux Debian上安装PHP cURL


How do I install PHP cURL on Linux Debian?

如何在Linux Debian上安装PHP cURL?我尝试了以下代码,在下面得到了错误

apt-get update
apt-get install curl libcurl3 php5-curl

错误:

W: Failed to fetch http://zm.archive.ubuntu.com/ubuntu/dists/precise-updates/universe/binary-i386/Packages  Something wicked happened resolving 'zm.archive.ubuntu.com:http' (-5 - No address associated with hostname)
W: Failed to fetch http://zm.archive.ubuntu.com/ubuntu/dists/precise-updates/multiverse/binary-i386/Packages  Something wicked happened resolving 'zm.archive.ubuntu.com:http' (-5 - No address associated with hostname)
W: Failed to fetch http://zm.archive.ubuntu.com/ubuntu/dists/precise-updates/main/i18n/Translation-en_US  Something wicked happened resolving 'zm.archive.ubuntu.com:http' (-5 - No address associated with hostname)
W: Failed to fetch http://zm.archive.ubuntu.com/ubuntu/dists/precise-updates/main/i18n/Translation-en  Something wicked happened resolving 'zm.archive.ubuntu.com:http' (-5 - No address associated with hostname)
W: Failed to fetch http://zm.archive.ubuntu.com/ubuntu/dists/precise-updates/multiverse/i18n/Translation-en_US  Something wicked happened resolving 'zm.archive.ubuntu.com:http' (-5 - No address associated with hostname)
W: Failed to fetch http://zm.archive.ubuntu.com/ubuntu/dists/precise-updates/multiverse/i18n/Translation-en  Something wicked happened resolving 'zm.archive.ubuntu.com:http' (-5 - No address associated with hostname)
W: Failed to fetch http://zm.archive.ubuntu.com/ubuntu/dists/precise-updates/restricted/i18n/Translation-en_US  Something wicked happened resolving 'zm.archive.ubuntu.com:http' (-5 - No address associated with hostname)
W: Failed to fetch http://zm.archive.ubuntu.com/ubuntu/dists/precise-updates/restricted/i18n/Translation-en  Something wicked happened resolving 'zm.archive.ubuntu.com:http' (-5 - No address associated with hostname)
W: Failed to fetch http://zm.archive.ubuntu.com/ubuntu/dists/precise-updates/universe/i18n/Translation-en_US  Something wicked happened resolving 'zm.archive.ubuntu.com:http' (-5 - No address associated with hostname)
W: Failed to fetch http://zm.archive.ubuntu.com/ubuntu/dists/precise-updates/universe/i18n/Translation-en  Something wicked happened resolving 'zm.archive.ubuntu.com:http' (-5 - No address associated with hostname)
E: Some index files failed to download. They have been ignored, or old ones used instead.

我解决了这个问题。我的Linux系统无法浏览和解析主机名。在添加了适当的根之后,问题得到了解决。

在控制台中以root身份键入:

apt-get update && apt-get install php5-curl

或使用sudo:

sudo apt-get update && sudo apt-get install php5-curl

对不起,我读错了。

首先,检查你的DNS配置,如果你能ping任何主机,

ping google.com
ping zm.archive.ubuntu.com

如果不起作用,请检查/etc/resolv.conf/etc/network/resolv.conf,如果不起,请将apt源更改为其他源。

/etc/apt/sources.list

后视镜:http://www.debian.org/mirror/list

你不应该在Debian上使用Ubuntu源代码,反之亦然。

我写了一篇关于topis的文章,介绍如何[在debian-linu][1]x上手动安装curl。

[1] :http://www.jasom.net/how-to-install-curl-command-manually-on-debian-linux.这是它的快捷方式:

  1. cd/usr/local/src
  2. wgethttp://curl.haxx.se/download/curl-7.36.0.tar.gz
  3. tar-xvzf curl-7.36.0.tar.gz
  4. rm*.gz
  5. cd curl-7.6.0
  6. /配置
  7. 制造
  8. 进行安装

然后重新启动Apache。如果在第6点中出现错误,请尝试运行apt-get-install-build-ential

无论采取何种方法,最终都要确保拥有curl和libcurl的更新版本。您可以执行curl --version并查看版本。

以下是我为在Ubuntu中安装最新的curl版本所做的:

  1. sudo add-apt-repository "deb http://mirrors.kernel.org/ubuntu wily main"
  2. sudo apt-get update
  3. sudo apt-get install curl