PHP中的Mongodb连接无法正常工作 [英] Mongodb connection in PHP not working
问题描述
我正在使用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
现在,当我进行检查时-
Now when I am Checking by -
echo extension_loaded("mongo") ? "loaded\n" : "not loaded\n";
显示未加载.
但是我用extension=mongo.so
更新了php.ini并重新启动了服务器,但是它不起作用.
However I updated the php.ini with extension=mongo.so
and restarted the server, but its not working.
现在让我做错了什么.
编辑
我重新实例化了命令,以下是结果-
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屋!