PHP cannot load dynamic library (mongo.so)

I am trying to use rockmongo. After installation, I can not use it. It says: " For everything to be correct, you must install the php_mongo module. Here, to install documents on PHP.net. "

I already installed the mongoDB driver extension through sudo pecl install mongo .

locate mongo shows /usr/lib/php5/20090626+lfs/mongo.so

However php -v shows some warnings (which I think are related to 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 

i opened /usr/lib/php5/ and found out that there is another directory ( 20090626 + lfs ) that contains mongo.so.

I tried various online tutorials, but nothing helped.

Edit : here is my mongodb.ini

 ;----- 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 ----- 
+7
php mongodb
source share
3 answers

I solved this problem using version 1.1.9 of mongodb. First uninstall the current version of mongodb, and then install version 1.1.9:

 sudo pecl uninstall mongodb sudo pecl install mongodb-1.1.9 composer update 
+6
source share

My version of php is 7.0, but it should also work with version 5.x.

If you have it in /etc/php/7.0/mods-available/mongo.ini

 extension=mongodb.so 

Comment on this line. After that restart php and it should work.

+1
source share

Add the full path to the mongo.so extension in mongodb.ini :

 extension=/usr/lib/php5/20090626+lfs/mongo.so 

Also [mongo] should be written in the same way as NOT \[mongo\] .

Remember to reload / reload the web server to load the new configuration.

You can check that everything is in order:

 php -i | grep mongo 
0
source share

All Articles