安装MongoDB PHP驱动程序的方法

时间:2013-06-24 08:28:15

标签: php mongodb ubuntu-12.04

我正在尝试为Mongo DB启用PHP。解决方案是相同的(在每个论坛中首先安装php5-dev),但安装失败并出现错误。

任何想法如何解决问题?

注意:使用Ubuntu 12:04

jojo@ubuntu:~$ sudo apt-get install php-pear php5-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php-pear : Depends: php5-cli but it is not going to be installed
 php5-dev : Depends: autoconf (>= 2.63) but it is not installable
            Depends: automake (>= 1.11) but it is not installable
            Depends: libtool (>= 2.2) but it is not installable
            Depends: shtool but it is not installable
E: Unable to correct problems, you have held broken packages.
jojo@ubuntu:~$ 

6 个答案:

答案 0 :(得分:9)

假设您已经安装了MongoDB,可以通过此命令为MongoDB安装PHP驱动程序

sudo apt-get install php5-mongo

答案 1 :(得分:3)

sudo apt-get install php5-mongo

在PHP 5.5.9 / Ubuntu 14.04 LTS上工作

答案 2 :(得分:2)

我建议这样做:

apt-get update
apt-get upgrade

然后安装:

apt-get install php5-cli php5-dev

然后:

apt-get install php-pear
pecl install mongo

答案 3 :(得分:2)

我使用this pagesources.list创建了一个新内容,然后安装了Synaptic Package Manager来安装解决问题的新内容。

答案 4 :(得分:0)

这似乎不像是安装php5-dev甚至是mongo扩展程序的问题,还有更多因以下冲突:

Depends: autoconf (>= 2.63) but it is not installable
Depends: automake (>= 1.11) but it is not installable
Depends: libtool (>= 2.2) but it is not installable
Depends: shtool but it is not installable

您可以使用sudo aptitude show <package>获取有关这些内容的更多信息,这可能会让您了解与其冲突的其他已安装软件包。从个人经验来看,我只需安装build-essential包就可以在Ubuntu上进行任何C / C ++编译。这个高级包通常最终会覆盖这些依赖关系。

答案 5 :(得分:0)

http://docs.mongodb.org/ecosystem/drivers/php/

此链接提供我们需要为不同的operting系统执行的所有命令,以便为mongoDb安装php驱动程序