简体   繁体   English

如何在Linux Debian上安装PHP cURL?

[英]How do I install PHP cURL on Linux Debian?

How do I install PHP cURL on Linux Debian? 如何在Linux Debian上安装PHP cURL? I tried the following code and got the error below 我尝试了以下代码并得到以下错误

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. 我的Linux框无法浏览和解析主机名。 After adding appropriate roots, the issue was resolved. 添加适当的根后,问题得到解决。

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, 1,检查你的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源,反之亦然。

I wrote an article on topis how to [manually install curl on debian linu][1]x. 我在topis上写了一篇文章如何[在debian linu上手动安装curl] [1] x。

[1]: http://www.jasom.net/how-to-install-curl-command-manually-on-debian-linux . [1]: http//www.jasom.net/how-to-install-curl-command-manually-on-debian-linux This is its shortcut: 这是它的捷径:

  1. cd /usr/local/src cd / usr / local / src
  2. wget http://curl.haxx.se/download/curl-7.36.0.tar.gz wget http://curl.haxx.se/download/curl-7.36.0.tar.gz
  3. tar -xvzf curl-7.36.0.tar.gz tar -xvzf curl-7.36.0.tar.gz
  4. rm *.gz rm * .gz
  5. cd curl-7.6.0 cd curl-7.6.0
  6. ./configure 。/配置
  7. make 使
  8. make install make install

And restart Apache. 并重新启动Apache。 If you will have an error during point 6, try to run apt-get install build-essential . 如果您在第6点遇到错误,请尝试运行apt-get install build-essential

Whatever approach you take, make sure in the end that you have an updated version of curl and libcurl. 无论采用何种方法,最后确保您拥有curl和libcurl的更新版本。 You can do curl --version and see the versions. 你可以做curl --version并查看版本。

Here's what I did to get the latest curl version installed in Ubuntu: 以下是我在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

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

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