我想用rockmongo.安装后,我无法使用它.上面写着"To make things right, you must install php_mongo module. Here for installation documents on PHP.net."

我已经通过sudo pecl install mongo安装了mongoDB驱动程序扩展.

locate mongo场秀/usr/lib/php5/20090626+lfs/mongo.so

然而,php -v显示的警告很少(我认为这与mongo有关)

PHP:  syntax error, unexpected $end, expecting ']' in /etc/php5/cli/conf.d/mongodb.ini on line 3
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525+lfs/mongo.so' - /usr/lib/php5/20100525+lfs/mongo.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP 5.4.28-1+deb.sury.org~precise+1 (cli) (built: May  5 2014 09:39:26) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

我打开/usr/lib/php5/,发现还有一个目录(20090626+lfs)包含mongo.所以

我try 了各种在线教程,但没有任何帮助.

Edit:这是我的mongodb.伊尼

;----- start -----
extension=mongo.so
\[mongo\]
; If the driver should reconnect to mongo
mongo.auto_reconnect = true
; Whether to allow persistent connections
mongo.allow_persistent = On
; Maximum number of persistent connections (-1 means unlimited)
mongo.max_persistent = -1
; Maximum number of links (persistent and non-persistent, -1 means unlimited)
mongo.max_connections = -1
; Default host for mongo connection
mongo.default_host = www.example.com
; Default port for mongo database
mongo.default_port = 42
; When saving files to the database, size of chunks to split them into
mongo.chunk_size = 1024
; Specify an alternate character to $ to use for special db functions ($set, $push, $exists, etc.)

mongo.cmd = "$"
;----- end -----

推荐答案

我使用1.1.9版本的mongodb php 5驱动程序解决了这个问题.首先卸载当前版本的mongodb,然后安装1.1.9版本:

sudo pecl uninstall mongodb
sudo pecl install mongodb-1.1.9
composer update

Mongodb相关问答推荐

$mod只支持数字类型,不支持MongoDb中的array和int

为什么我的Mongoose更新找不到匹配?

MongoDB:如何从数组中的所有对象中删除属性?

MongoDB 聚合 groupBy 日期并计算子文档

Mongodb 按数组元素聚合组

Mongoose 和 MongoDB,如何在具有多个引用的两个模型之间创建关系?

Pymongo API TypeError: Unhashable dict

创建索引需要很长时间

使用 MongoDB 进行分页

如何使用sailsjs v0.10连接mongodb?

$elemMatch 的 MongoDB 索引

在 mongodb 中查找字段的所有非不同值

如何为 node.js 中的 MongoDB 索引指定 javascript 对象中的属性顺序?

MongoDB的数据库管理工具

C# MongoDB 驱动程序 - 如何使用 UpdateDefinitionBuilder?

如何在 $match 内的 mongodb 聚合查询中使用 $regex

我如何将 mongodb 与electron一起使用?

MongoDB:删除唯一约束

在 MongoDB 中比较日期(moment.js)

开发人员必须采取哪些mental steps才能开始从 SQL 迁移到 NOSQL(CouchDB、Fathom DB、MongoDB 等)?