PHP找不到驱动程序的MongoDB [英] PHP cannot find MongoDB driver

查看:298
本文介绍了PHP找不到驱动程序的MongoDB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Ubuntu 12.04安装我从ondej软件包安装PHP5(5.5)。一切工作正常与PHP,Apache和MySQL,我也成功安装蒙戈daemom和蒙戈客户端。但随后PHP无法找到梨的MongoDB的驱动程序。

On my Ubuntu 12.04 installation I install PHP5 (5.5) from the ondej package. Everything works ok with the PHP, Apache and MySQL, I also successfully install Mongo daemom and Mongo client. But then PHP cannot locate the MongoDB driver in pear.

我已经按照所有的步骤我已经加入了扩展的CLI文件夹中的php.ini文件重新启动服务器更新的一切,再次重新启动服务器的文档中解释。

I have followed all the steps explained in the documentation I have added the extension to the php.ini file in the CLI folder restarted the server updated everything and restart the server again.

我一直停留在这个问题上已经相当长的时间。我应该在哪里看在我的Ubuntu是一个虚拟机上运行也是我在VMWare和VirtualBox的(不是说这有什么,据我知道该怎么做)。

I have been stuck on this issue quite long time now. Where should I look in. My Ubuntu is also running on a virtual machine I have tried both on VMWare and VirtualBox (not that this has anything to do as far as I know).

感谢

P.S。有两个类似的问题在这里,但他们并没有帮助我解决我的问题。

P.S. There are two similar issues here but they did not help me to solve my problem.

推荐答案

我可以给你从一个新安装的12.04我的构建配方。新鲜的是,通过简单的配置和运行只选择在年底为方便起见,SSH服务器选项。

I can give you my build recipe from a fresh 12.04 installation. Fresh being simply running through the configuration and only selecting the "SSH server" option at the end for convenience.

MongoDB的安装是可选的,所以如果你想这是一个不同的服务器上,然后跳过。但总的指示来自:

MongoDB installation is optional, so if you want this on a different server then skip. But the general instructions come from:

http://docs.mongodb.org/manual/tutorial /安装-MongoDB的-上的Ubuntu /

所有的命令分头行动,而不是自动的,所以你可以看到步骤:

All commands split up and not automated so you can see the steps:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get install software-properties-common
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php5
sudo apt-get update
sudo apt-get install mongodb-10gen
sudo apt-get install build-essential
sudo apt-get install php5-dev
sudo apt-get install libcurl4-openssl-dev
sudo pecl install mongo

编译器输出的地段。成功结束,并要求以mofidy的php.ini

Lots of compiler output. Ending with success and asking to mofidy php.ini

编辑CLI设置。做同样为Apache的配置以及

Edit the CLI settings. And do the same for the apache config as well

sudo vi /etc/php5/cli/php.ini
sudo vi /etc/php5/apache2/php.ini

个人preference,在动态扩展的意见后,

Personal preference, after the comments on 'Dynamic Extensions'

extension=mongo.so

测试了使用和连接不会引发错误。创建test.php的:

Test that usage and connection does not throw an error. Create test.php:

<?php

    $m = new MongoClient('mongodb://localhost/',
        array('connectTimeoutMS'=> 500, 'socketTimeoutMS' => 500 ));

?>

和运行命令行:

php test.php

没有错误。然后,你都成立。

No errors. Then you are all set up.

$ php -v
PHP 5.5.3-1ubuntu2.1 (cli) (built: Dec 12 2013 04:24:35)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
    with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies

这篇关于PHP找不到驱动程序的MongoDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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