9

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.

kavisiegel
  • 349
  • 1
  • 3
  • 12

2 Answers2

12

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.
womble
  • 95,029
  • 29
  • 173
  • 228
2

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.

kavisiegel
  • 349
  • 1
  • 3
  • 12