如何在 Linux Debian 上安装 PHP cURL?

2022-08-30 20:27:50

如何在 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 机箱无法浏览和解析主机名称。添加适当的根目录后,问题得到解决。


答案 1

以 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

如果它不起作用,请检查或,如果没有,请将您的apt-source更改为其他源。/etc/resolv.conf/etc/network/resolv.conf

/etc/apt/sources.list

镜子:http://www.debian.org/mirror/list

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


答案 2

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

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

  1. cd /usr/local/src
  2. wget http://curl.haxx.se/download/curl-7.36.0.tar.gz
  3. 焦油-xvzf curl-7.36.0.tar.gz
  4. rm *.gz
  5. cd curl-7.6.0
  6. ./configure
  7. 进行安装

然后重新启动 Apache。如果您在第 6 点遇到错误,请尝试运行 apt-get install-build-essential


推荐