PHP中的Mongodb连接不起作用 [英] Mongodb connection in PHP not working

查看:16
本文介绍了PHP中的Mongodb连接不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Ubuntu 12.04 LTS 并在 /opt/lampp/bin/ 中安装了 pecl.

I am using Ubuntu 12.04 LTS and installed pecl in /opt/lampp/bin/ .

第二次安装时抛出错误-

When installing second time its throwing error -

之前运行的命令 -

pecl install mongo

pecl/mongo 已经安装,和发布的一样1.5.1版安装失败

pecl/mongo is already installed and is the same as the released version 1.5.1 install failed

现在当我检查时 -

echo extension_loaded("mongo") ?"已加载 " : "未加载 ";

echo extension_loaded("mongo") ? "loaded " : "not loaded ";

显示未加载.

但是我用 extension=mongo.so 更新了 php.ini 并重新启动了服务器,但它不起作用.

However I updated the php.ini with extension=mongo.so and restarted the server, but its not working.

现在让我看看我做错了什么.

Let me now what I am doing wrong.

编辑

我重新实例化了命令,结果如下-

I re instantiated the command and following is the outcome -

Build process completed successfully
Installing '/opt/lampp/lib/php/extensions/no-debug-non-zts-20100525/mongo.so'
install ok: channel://pecl.php.net/mongo-1.5.1
configuration option "php_ini" is not set to php.ini location
You should add "extension=mongo.so" to php.ini

推荐答案

终于在Neil Lunn的帮助下我做对了.

Finally with the help of Neil Lunn I made it the right way.

我添加了完整路径,并在我的 php.ini

I added the full path and added the code at the very last line of my php.ini

extension="/opt/lampp/lib/php/extensions/no-debug-non-zts-20100525/mongo.so"

extension="/opt/lampp/lib/php/extensions/no-debug-non-zts-20100525/mongo.so"

这篇关于PHP中的Mongodb连接不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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