1. Add MAMP’s bin to the $PATH, make suit with your PHP version:php
export PATH="/Applications/MAMP/bin/php/php5.x.x/bin:$PATH"
2. Download PHP source same with your PHP version and put into /Applications/MAMP/bin/php/php5.x.x/include
3. Configure PHP:mongodb
cd /Applications/MAMP/bin/php/php5.x.x/include/php
./configure
4. When finish, install mongodb:服務器
sudo pecl install mongo
5. Go to MAMP and edit template PHP.ini and add mongodb extension:ui
extension=mongo.so
6. Restart your MAMP and you check phpinfo() to make sure mongodb extension installed perfectly.blog
7.安裝Mongo PHP Driverit
sudo pecl install mongodb
而後去php.ini裏面添加io
extension=mongodb.so
ok從新服務器搞定。class