Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing Mongo Driver on MAMP

I have downloaded, compiled and installed the latest mongo driver for php & it's been placed at:

 /opt/local/lib/php/extensions/no-debug-non-zts-20090626/mongo.so

How would I go about adding this to the MAMP php.ini file? I have looked at just trying to add the "extention=mongo.so" however this does not work. I also tried to place the mongo.so file inside the dir:

/Applications/MAMP/bin/php/php5.4.4/lib/php/extensions/no-debug-xxx/

And added the correct line of code to php.ini...

Would I have to tell it the directory the extension is in?

like image 369
Callum Avatar asked Aug 25 '26 14:08

Callum


2 Answers

To install latest Mongo driver on MAMP

1 - install autoconf using homebrew or Mac Ports

brew install autoconf

2 - Download php 5.4.10 source from php.net.

3 - rename uncompressed php source folder from php-5.4.10 to php and paste it in this folder

/Applications/MAMP/bin/php/php5.4.10/include/

4- using the terminal open php folder and run ./configure

cd /Applications/MAMP/bin/php/php5.4.10/include/php/ && ./configure

5 - Add MAMP bin to your ~/.bash_profile

echo "export PATH=/Applications/MAMP/bin/php/php5.4.10/bin:$PATH" >> ~/.bash_profile source ~/.bash_profile

6 - install latest mongo

pecl install mongo

7- restart MAMP server :).

8- Enable the extension Edit /Applications/MAMP/bin/php/php5.4.10/conf/php.ini Add the following line after the section named "; Extensions":

extension=mongo.so

like image 157
AbdullahDiaa Avatar answered Aug 28 '26 06:08

AbdullahDiaa


Before you go off trying to install mongo, you really should install MAMPs special tools for adding extensions and follow this tutorial for getting set up:

http://blog.jellystyle.com/post/37099202581/installing-php-extensions-with-mamp

This allows you to use the correct pecl, the correct pear, and will install mongo.so in the correct location for MAMP to use it.

Then, from there just run sudo pecl install mongo and restart the MAMP service.

Then.... edit the php.ini file:

  1. Find the Extensions section via search (in vim you can just type /Extensions and hit enter
  2. under the Extensions section add this line if it isn't already there: extension=mongo.so
  3. make sure the path to mongo.so is something like this: /Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/mongo.so
like image 41
Kristian Avatar answered Aug 28 '26 04:08

Kristian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!