Maxim Shoustin
Maxim Shoustin

Reputation: 77910

Still get error Unable to load dynamic library '/home/max/mongo/bin/mongo'

I opened package and installed mongoDB and got:

[root@feeder /]# cd /home/max/mongodb-linux-i686-2.4.3/bin
[root@feeder bin]# ls -l
total 231700
-rwxr-xr-x 1 root root 17828204 Apr 23 00:01 bsondump
-rwxr-xr-x 1 root root  9181648 Apr 23 00:04 mongo
-rwxr-xr-x 1 root root 17882692 Apr 23 00:03 mongod
-rwxr-xr-x 1 root root 17885740 Apr 22 23:56 mongodump
-rwxr-xr-x 1 root root 17840780 Apr 22 23:57 mongoexport
-rwxr-xr-x 1 root root 17883768 Apr 23 00:00 mongofiles
-rwxr-xr-x 1 root root 17852780 Apr 22 23:58 mongoimport
-rwxr-xr-x 1 root root 17832300 Apr 23 00:00 mongooplog
-rwxr-xr-x 1 root root 17832876 Apr 23 00:02 mongoperf
-rwxr-xr-x 1 root root 17890796 Apr 22 23:56 mongorestore
-rwxr-xr-x 1 root root 13491532 Apr 23 00:03 mongos
-rwxr-xr-x 1 root root 17795196 Apr 23 00:02 mongosniff
-rwxr-xr-x 1 root root 17877452 Apr 22 23:58 mongostat
-rwxr-xr-x 1 root root 17832268 Apr 22 23:59 mongotop

All works fine and can connect with mongoVUE monitor tool.

So far so good.

Now, I try to connect to BongoDB from PHP:

I added to php.ini (nano /etc/php.ini): extension=/home/max/mongo/bin/mongo

and restarted httpd: /etc/init.d/httpd restart

from code:

$conn = new Mongo('localhost');

I get an error:

PHP Warning: PHP Startup: Unable to load dynamic library '/home/max/mongo/bin/mongo' - /home/max/mongo/bin/mongo: wrong ELF class: ELFCLASS32 in Unknown on line 0

PS

I tried also: extension=/home/max/mongo/bin/mongo.so but still get the same error.

Did I miss something?

Additional Info from phpinfo()

Please, help

Thanks,

[EDIT] I have PHP 64 bit, according to Farkie, I installed bongoDB 64 bit. Still get error but without "worng ELF":

 php -i | grep mongo

PHP Warning: PHP Startup: Unable to load dynamic library '/home/max/mongo/bin/mongo' - /home/max/mongo/bin/mongo: cannot dynamically load executable in Unknown on line 0

I don't see mongo.so under /usr/lib64/php/modules/

Upvotes: 0

Views: 1995

Answers (2)

Burhan Khalid
Burhan Khalid

Reputation: 174662

This is not how you configure PHP for Mongo. Read the documentation and you'll find out that there is a specific PHP extension you have to build.

Upvotes: 0

Farkie
Farkie

Reputation: 3337

You have a 64bit mongo.so, but a 32bit version of PHP (Or the other way round).

Upvotes: 2

Related Questions