如何在 Linux Debian 上安装 PHP cURL?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20073676/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I install PHP cURL on Linux Debian?
提问by Inventor
How do I install PHP cURL on Linux Debian? I tried the following code and got the error below
如何在 Linux Debian 上安装 PHP cURL?我尝试了以下代码并得到以下错误
apt-get update
apt-get install curl libcurl3 php5-curl
Error:
错误:
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.
I resolved this issue. My Linux box was unable to browse and resolve hosts names. After adding appropriate roots, the issue was resolved.
我解决了这个问题。我的 Linux 机器无法浏览和解析主机名。添加适当的根后,问题就解决了。
回答by Daniel W.
Type in console as root:
以 root 身份在控制台中输入:
apt-get update && apt-get install php5-curl
or with sudo:
或使用 sudo:
sudo apt-get update && sudo apt-get install php5-curl
Sorry I missread.
抱歉我看错了。
1st, check your DNS config and if you can ping any host at all,
1st,检查您的 DNS 配置,如果您可以 ping 任何主机,
ping google.com
ping zm.archive.ubuntu.com
If it does not work, check /etc/resolv.conf
or /etc/network/resolv.conf
, if not, change your apt-source to a different one.
如果它不起作用,请检查/etc/resolv.conf
或/etc/network/resolv.conf
,如果没有,请将您的 apt-source 更改为不同的源。
/etc/apt/sources.list
Mirrors: http://www.debian.org/mirror/list
镜像:http: //www.debian.org/mirror/list
You should not use Ubuntu sources on Debian and vice versa.
您不应在 Debian 上使用 Ubuntu 源代码,反之亦然。
回答by Jasom Dotnet
I wrote an article on topis how to [manually install curl on debian linu][1]x.
我写了一篇关于如何[在 debian linu 上手动安装 curl][1]x 的文章。
[1]: http://www.jasom.net/how-to-install-curl-command-manually-on-debian-linux. This is its shortcut:
[1]:http: //www.jasom.net/how-to-install-curl-command-manually-on-debian-linux。这是它的快捷方式:
- cd /usr/local/src
- wget http://curl.haxx.se/download/curl-7.36.0.tar.gz
- tar -xvzf curl-7.36.0.tar.gz
- rm *.gz
- cd curl-7.6.0
- ./configure
- make
- make install
- cd /usr/local/src
- wget http://curl.haxx.se/download/curl-7.36.0.tar.gz
- tar -xvzf curl-7.36.0.tar.gz
- rm *.gz
- cd curl-7.6.0
- 。/配置
- 制作
- 进行安装
And restart Apache. If you will have an error during point 6, try to run apt-get install build-essential.
并重新启动Apache。如果在第 6 点出现错误,请尝试运行apt-get install build-essential。
回答by genegc
Whatever approach you take, make sure in the end that you have an updated version of curl and libcurl. You can do curl --version
and see the versions.
无论您采用何种方法,最后都要确保您拥有 curl 和 libcurl 的更新版本。您可以执行curl --version
并查看版本。
Here's what I did to get the latest curl version installed in Ubuntu:
这是我为在 Ubuntu 中安装最新的 curl 版本所做的工作:
sudo add-apt-repository "deb http://mirrors.kernel.org/ubuntu wily main"
sudo apt-get update
sudo apt-get install curl
sudo add-apt-repository "deb http://mirrors.kernel.org/ubuntu wily main"
sudo apt-get update
sudo apt-get install curl