Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Working with Ubuntu 12.04 here, nginx and php5-fpm

I had mongo working well on php 5.3, then I added the ondrej/php5 ppa and updated to php5.4. It kept GD and CURL extensions, but not mongo. I re-added the line to the php.ini file, and nothing. Then I enabled startup errors and got this:

PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/mongo.so' - /usr/lib/php5/20100525/mongo.so: cannot open shared object file: No such file or directory

So, wild guess, I did find -name 'mongo.so' and moved the file from 20090626/ to 20100525/ ...which resulted in this error:

PHP Startup: mongo: Unable to initialize module
Module compiled with module API=20090626
PHP    compiled with module API=20100525
These options need to match

I then did pecl uninstall mongo and pecl install mongo - which created the new mongo.so file right back in 20090626/

I'm kinda new to all this so hopefully this is a blind easy mistake to fix! I just need to get mongo back up and running.

share|improve this question

2 Answers 2

up vote 8 down vote accepted

My guess would be either:

  • pecl install mongo is actually installing a pre-built binary (which would be really dumb, but wouldn't be nearly as surprising); or
  • You've still got the old php5-dev package from your 5.3 installation sitting around, and pecl is finding and using that instead of the 5.4 version. Take a look at your PHP-related packages list (dpkg -l '*php*') and see if there's any 5.3 packages left, and upgrade them.
share|improve this answer
    
I was just answering my own question with this! Thanks! –  kavisiegel Jul 12 '12 at 6:22
    
So which one was it? –  womble Jul 12 '12 at 6:24
2  
I had to update php5-dev, uninstall mongo then reinstall. –  kavisiegel Jul 12 '12 at 6:26

Great minds think alike, womble posted moments after I figured out what's going on. His answer is correct and before mine so it's what I'll accept as the answer, but for future reference, the solution was this:

apt-get update
apt-get install php5-dev
pecl uninstall mongo
pecl install mongo
/etc/init.d/php5-fpm restart

And of course, mongo.so was already in the php.ini in a way that pecl didn't remove it, so that made it slightly easier to upgrade.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.