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 (http://osdir.com/ml/mongodb-user/2009-11/msg00463.html) 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. Trackbacks are closed, but you can post a comment.

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

One Comment

  1. Posted January 11, 2010 at 4:13 pm | Permalink

    Just so you know, more recent binaries are available at http://github.com/mongodb/mongo-php-driver/downlo... (look for the .zips with "osx" in the name).

    Being able to compile from source is nicer, though!

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

  • About

    I'm Nobu, a web developer living in Mountain View, CA. Feel free to comment on any posts. I'm also tweeting on twitter.

  • Archives

  • Recent Posts