Installing PHP Couchbase extensions and libcouchbase on Mac

Following the instructions from http://www.couchbase.com/develop/php/current and http://www.couchbase.com/develop/php/next didn’t work for me. When using the next version, with libcouchbase installed the recommend way (the way I show you not to do it below), I got this error when using their precompiled binary:

I tried using the latest version of libcouchbase (also shown below); there were no more startup warnings, but the extension was just not showing up in the modules list. Next, I switched to using the precompiled binary from the current version. Again, no PHP startup warnings, but the extension was just not showing up. So, I poked around and found this combination that works on both OS X 10.7 and OS X 10.8.

We simply need to install the latest version of libcouchbase and then compile the Coucbase PHP extension ourselves.

First off, do not do:

This will installs the wrong version and you’ll see an error like this when you get to the ./configure step.

Instead, install the latest version of libcouchbase, and get the couchbase php extension source code and compile it:

Then, register the couchbase extension by adding the following to your php.in. Mine is /etc/php.ini.

Now, you can confirm that PHP is loading this new extension by doing:

You should see couchbase in the list of modules. If you see it there, everything has gone according to plan. ┬áIf it doesn’t show up and you see no startup warnings, you can try specifying the extensions path explicitly.

Lastly, restart Apache

and double check that the couchbase module is being shown when you do a phpinfo();

 

Hi there, I'm Justin!

I like to teaching people about programming. Well, yeah, I guess it's obvious, I also like to write. Yes that was a Digital Underground reference.

 

2 thoughts on “Installing PHP Couchbase extensions and libcouchbase on Mac

  1. Hi Justin! By any chance can you share your couchbase.so file? I followed your instructions and I get stuck on configure:

    checking for libcouchbase files in default path… found in /usr/local
    checking for libcouchbase_connect in -lcouchbase… no
    checking for lcb_connect in -lcouchbase… no
    configure: error: libcouchbase not found

  2. Did brew install https://github.com/couchbase/homebrew/raw/preview/Library/Formula/libcouchbase.rb complete successfully?

    Sorry the late response, I was on vacation.

Comments are closed.