Skip to content

Instantly share code, notes, and snippets.

@cmalven
Created August 7, 2015 15:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmalven/ff74016fee6dff6be8b7 to your computer and use it in GitHub Desktop.
Save cmalven/ff74016fee6dff6be8b7 to your computer and use it in GitHub Desktop.
Installing Mongo PHP extension for MAMP on Mac OS X

Open your .bashrc or .zshrc file and add:

# Mamp PHP Path
export PATH=/Applications/MAMP/bin/php/php5.6.10/bin:$PATH

The version number here should correspond to the version you're using in MAMP.

Next, open /Applications/MAMP/bin/php/php5.6.10 and add a folder called include and within that a folder called php

Next, you'll need to download the PHP components for php 5.6.10 (or whatever version you're using). You can (hopefully) find this at:

Copy the contents of this into the php folder you just created.

In your console, navigate to /Applications/MAMP/bin/php/php5.6.10/include/php and run ./configure. This will compile all the PHP libraries you need.

In your console, navigate to /Applications/MAMP/bin/php/php5.6.10/bin and run sudo pecl install mongo

If this command is successful, last step is to enable Mongo in PHP. Open your php.ini file (probably through the UI in MAMP), extension=mongo.so

@niksumeiko
Copy link

You're missing a link to the components mentioned !

@dadixon
Copy link

dadixon commented Dec 29, 2015

how to do you install mongodb.so in MAMP since MongoClient is deprecated now. Works in Linux but not MAMP.

@nikulinsanya
Copy link

Where is the link??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment