无法在MAMP中加载mongo扩展名

无法在MAMP中加载mongo扩展名

问题描述:

I'm trying to install the php mongo extension in MAMP but it doesn't work.

Here is what I did:

sudo pecl install mongo

And find the extension folder with:

php -i | grep extension_dir

extension_dir => /usr/lib/php/extensions/no-debug-non-zts-20100525 => /usr/lib/php/extensions/no-debug-non-zts-20100525

And copy the mongo.so file in MAMP:

sudo cp /usr/lib/php/extensions/no-debug-non-zts-20100525/mongo.so /Applications/MAMP/bin/php/php5.5.10/lib/php/extensions/

To finish, I added extension=mongo.so in:

/Applications/MAMP/bin/php/php5.5.10/conf/php.ini

But even after a MAMP restart, the mongo extension is not loaded in phpinfo().

I also tried to compile the extension with sources but same problem.

Thank you

I changed the PHP version to 5.4.4 and the extension is now well loaded.

I had a similar problem with MAMP for php 5.5.10 - turns out MAMP has the php.ini files in two different places - /Applications/MAMP/conf/php.5.5.10 and /Applications/MAMP/bin/php/php5.5.10/conf! It uses the latter, but I was editing the former. Hope this is helpful to someone else!