Install PHP Mongodb driver on MAMP OSX

If you use MAMP and want to use mongodb database, here’s the following step to install PHP Mongo driver.
Requirements: Xcode installed.
1. Grab the latest PHP mongodb driver
$ git clone
$ cd mongo-php-driver
$ /Applications/MAMP/bin/php/php5.4.4/bin/phpize
suit the phpize location with your PHP version. In this case i am using PHP 5.4.4.
$ ./configure
$ make
if you got error like this:
mongo-php-driver/php_mongo.c:16:10: fatal error: ‘php.h’ file not found
#include then you should copy php headers into your MAMP folder
$ cp -r /Applications/ /Applications/MAMP/bin/php/php5.4.4/include
$ sudo cp modules/ /Applications/MAMP/bin/php/php5.4.4/lib/php/extensions/no-debug-non-zts-20100525/
again suit the extension location
2. Open your MAMP GUI and go to File – Edit Template – PHP 5.4.4 ini
3. Add the following line:
4. Restart your MAMP web server and check with phpinfo() and you should get the mongodb installed

Leave a Reply

Your email address will not be published. Required fields are marked *