Maybe as you guessed from my previous post, I develop on a Mac with MAMP. I really like the interface of the pro version compared to other programs like XAMPP. But it seems very difficult to install PEAR extensions with it. This post will explain how to install the MongoDB extension, but I guess this technique can be applied to a lot of other extensions too.
- At first, download PHP’s source code that matches the version you’re using with MAMP from PHP.net. I am using 5.3.6, so I downloaded this package.
- Extract the contents of it to the following folder:
- Run the following command in this folder:
- The PEAR conf file causes some weird issues in MAMP, so we better remove it:
- Now install the MongoDB extension with help of PECL
./pecl install mongo
- Activate the installed extension in your php.ini file:
And that’s it. You can now use a MongoDB server in PHP applications. Most of the credits of the above steps go to Matthias Schmidt.