Compiling mongo php driver on pecl for MAMP

MAMP 1.8.2 includes pecl but actually it doesn’t work. When trying to “pecl install mongo”, there will be an error.
grep: /Applications/MAMP/bin/php5/include/php/main/php.h: No such file or directory

So, I downloaded source tar ball of PHP 5.2.10 (same version as MAMP’s PHP) and configure && make && make install. Then $prefix/include directory will be created. Just copy them into /Application/MAMP/bin/php5/. It might be better to set prefix like this “./configure –prefix=/opt/apps/php-5.2.10”

Now pecl works well. You can get version 1.0.2 right now.

BTW, there is a link for a compiled .so file ( but it’s old (1.0.0+) that means “$connection->database” syntax doesn’t work well.
Notice: Undefined property: Mongo::$database in /Users/nobu/Sites/mongo.php on line 4

This entry was posted in Tweak and tagged , , . Bookmark the permalink. Both comments and trackbacks are currently closed.