php5-curl 依赖_我如何在php5中安装curl?

问题描述

我目前在10.04 Lucid中安装了Apache 5.3。我如何添加PHP Curl库?我是否需要为curl安装任何其他依赖项?

最佳解决思路

我相信包php5-curl应该可以做到。使用您选择的软件包管理器,并且应该照顾好软件。

sudo apt-get install php5-curl

之后您需要重新启动服务器:

sudo service apache2 restart

或者,如果您使用的是php-fpm,则需要重新启动php5-fpm

sudo service php5-fpm restart

次佳解决思路

我的conf:Ubuntu 11.10,已经安装了mysql,php5和apache2,然后在终端中安装php5-curl之前我做了:

编辑源列表如下:

sudo -H gedit /etc/apt/sources.list

下一个命令:

apt-get install aptitude

下一个命令:

aptitude install php5-curl

你得到这样的东西:

The following NEW packages will be installed:

php5-curl{b}

0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.

Need to get 27.1 kB of archives. After unpacking 127 kB will be used.

The following packages have unmet dependencies:

php5-curl: Depends: php5-common (= 5.3.6-13ubuntu3.1) but 5.3.6-13ubuntu3.8 is installed.

The following actions will resolve these dependencies:

Keep the following packages at their current version:

1) php5-curl [Not Installed]

Accept this solution? [Y/n/q/?] n

你的答案是n

下一行打印出来:

The following actions will resolve these dependencies:

Downgrade the following packages:

1) libapache2-mod-php5 [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)]

2) php5 [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)]

3) php5-cli [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)]

4) php5-common [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)]

5) php5-gd [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)]

6) php5-mysql [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)]

Accept this solution? [Y/n/q/?] y

你的答案是y。

在你的浏览器中打开phpinfo(),检查属性:

extension_dir /usr/lib/php5/20090626+lfs

在那个文件夹中你现在应该有curl.so

编辑php.ini

nano /etc/php5/apache2/php.ini

在下面找到”dynamic extensions”添加代码:

extension=curl.so

之后,重新启动apache2和check phpinfo(),curl必须启用

第三种解决思路

对于颠覆php5.6使用以下命令(测试Ubuntu 14.04):

sudo apt-get install software-properties-common

sudo add-apt-repository ppa:ondrej/php

sudo apt-get update

sudo apt-get upgrade

sudo apt-get install php5.6

php — version

sudo apt-get install php5.6-curl

第四种思路

安装LAMP和cURL扩展的完整解决方案:

sudo apt-get update

sudo apt-get install php5

sudo apt-get install libapache2-mod-php5

sudo apt-get install curl libcurl3 libcurl3-dev php5-curl

接着:

cd /etc/php5/apache2/

sudo nano php.ini

添加这个命令:extension=curl.so

最后一件事是restart apache

第五种思路

你需要安装php5-curl包。

sudo apt-get install php5-curl

第六种思路

运行以下命令

sudo apt-get install curl libcurl3 libcurl3-dev php5-mcrypt php5-curl

参考资料

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值