Other instructions indicate you can just run
sudo pecl install mongoOr
sudo pecl upgrade mongoBut this seemed to be for those using the XAMPP Developer Package. I was having trouble compiling an updated mongo.so file because my MAMP php installation was missing the necessary header files. I would get this error:
fatal error: 'php.h' file not foundI noticed when it tried to run phpize it couldn't find any of these:
#include <php .h>
^
1 error generated.
make: *** [php_mongo.lo] Error 1
ERROR: `make' failed
grep: /Applications/MAMP/bin/php/php5.3.6/include/php/main/php.h: No such file or directorySo I ran locate on them, and they did exist in Xcode:
grep: /Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend_modules.h: No such file or directory
grep: /Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend_extensions.h: No such file or directory
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/usr/include/php/main/php.hI tried copying the whole /include/php directory to my php directory in MAMP. I had to make an include folder in /Applications/MAMP/bin/php/php5.3.6/
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/usr/include/php/Zend/zend.h
cp -r /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/php /Applications/MAMP/bin/php/php5.3.6/includeWhen I ran 'sudo pecl upgrade mongo' it completed. I just had to restart apache/mysql and phpinfo() showed I was now using the 1.3.2 MongoDB driver.

