在Ubuntu 13.10(saucy)中安装Mongodb PHP扩展的最简单方法? [英] Easiest way to install Mongodb PHP extension in Ubuntu 13.10 (saucy)?

查看:363
本文介绍了在Ubuntu 13.10(saucy)中安装Mongodb PHP扩展的最简单方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Ubuntu 13.10(saucy salamander),我希望sudo apt-get install php5-mongo足以安装mongodb数据库驱动程序.

I'm using Ubuntu 13.10 (saucy salamander) and I was hoping that sudo apt-get install php5-mongo would be enough to get the mongodb database driver installed.

虽然没有这样的运气.我使用的是php5-fpm,所以首先我发现我也需要执行php5enmod mongo,但是即使这样,我仍然会出错:

No such luck though. I'm using php5-fpm, so firstly I found I also needed to do php5enmod mongo but even with that, I get a error:

include(MongoClient.php): failed to open stream: No such file or directory

相反,要安装,我必须执行以下操作(这会使用更多的磁盘空间):

Instead, to install I have to do the following (which uses a lot more disk space):

 sudo apt-get install php5-dev make php-pear
 sudo pecl install mongo
 sudo echo "extension=mongo.so" | tee /etc/php5/mods-available/mongo.ini

我的问题是为什么sudo apt-get install php5-mongo还不够? Ubuntu存储库有问题吗?我如何查看ubuntu信息库,并找到它使用的版本,或者为什么不包含MongoClient.php的原因.我以"ubuntu:saucy"泊坞窗映像为基础,我认为默认情况下它包含Universe.

My question is why isn't sudo apt-get install php5-mongo enough? Is it a problem with the Ubuntu repo? How can I look into the ubuntu repositories and find what version it uses or why MongoClient.php isn't included. I'm using the "ubuntu:saucy" docker image as my base and it includes universe by default I think.

推荐答案

在Ubuntu 14.04中,sudo apt-get install php5-mongo导致完全正常的mongo PHP扩展.因此,我想Ubuntu 13.10中只有一个包装问题会导致该问题.

In Ubuntu 14.04, sudo apt-get install php5-mongo results in a fully working mongo PHP extension. So I guess there is just a packaging problem in Ubuntu 13.10 which causes the problem.

解决方案:使用Ubuntu 14.04 LTS代替Ubuntu 13.10.

Solution: Use Ubuntu 14.04 LTS instead of Ubuntu 13.10.

但是,如果您必须使用Ubuntu 13.10,请不要使用php5-mongo Ubuntu软件包,而应通过pecl安装mongo扩展:

But, if you have to use Ubuntu 13.10, don't use the php5-mongo Ubuntu package, instead install the mongo extension via pecl:

sudo apt-get install php5-dev make php-pear
sudo pecl install mongo
sudo echo "extension=mongo.so" | sudo tee /etc/php5/mods-available/mongo.ini

这篇关于在Ubuntu 13.10(saucy)中安装Mongodb PHP扩展的最简单方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆