PHP中的Mongodb连接不起作用

Mongodb connection in PHP not working(PHP中的Mongodb连接不起作用)
本文介绍了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连接不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Convert JSON integers and floats to strings(将JSON整数和浮点数转换为字符串)
in php how do I use preg replace to turn a url into a tinyurl(在php中,如何使用preg替换将URL转换为TinyURL)
all day appointment for ics calendar file wont work(ICS日历文件的全天约会不起作用)
trim function is giving unexpected values php(Trim函数提供了意外的值php)
Basic PDO connection to MySQL(到MySQL的基本PDO连接)
PHP number_format returns 1.00(Php number_Format返回1.00)