azz0r
azz0r

Reputation: 3311

Failed to run mongo.so after upgrading php to 5.4.10

I get this error when viewing a php page using mongo: "Mongo could not be loaded"

and my command line says this:

/usr/lib/php5/20100525# php -i | fgrep -i configure
PHP Warning:  PHP Startup: mongo: Unable to initialize module
Module compiled with module API=20090626
PHP    compiled with module API=20100525
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/mongo.so' - /usr/lib/php5/20090626/mongo.so: cannot open shared object file: No such file or directory in Unknown on line 0

So I've ensured both 20090626 and 20100525 directory have mongo.so and restarted apache but it still wont work. I'm very confused. I've tried reinstalling with no luck.

Edit:

I've made sure both directories have the same extensions and now I get this:

PHP Warning:  PHP Startup: mongo: Unable to initialize module
Module compiled with module API=20090626
PHP    compiled with module API=20100525
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: mongo: Unable to initialize module
Module compiled with module API=20090626
PHP    compiled with module API=20100525
These options need to match
 in Unknown on line 0
root@ip-172-31-16-45:/usr/lib/php5# 

Upvotes: 3

Views: 2504

Answers (1)

jmikola
jmikola

Reputation: 6922

If you've upgraded your PHP binary, you will need to re-compile the MongoDB driver. Note the PHP development headers (e.g. php5-dev package on Ubuntu) should match the PHP binary (on the off chance you only updated the binary and not the development files). Assuming you used PECL, the following should recompile the driver:

$ sudo pecl install -f mongo

Upvotes: 5

Related Questions