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:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20100525/couchbase.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20100525/couchbase.so, 9): Library not loaded: /usr/local/lib/libcouchbase.2.dylib Referenced from: /usr/lib/php/extensions/no-debug-non-zts-20100525/couchbase.so Reason: image not found in Unknown on line 0
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:
brew install libcouchbase
This will installs the wrong version and you’ll see an error like this when you get to the ./configure step.
configure: error: It appears you are using libcouchbase 1.x This DP version of the php extension supports libcouchbase-2.0.0beta or higher. Either use a stable 1.0 version of the php extension, upgrade your libcouchbase, or specify the location of a libcouchbase-2.0.0 installation with --with-couchbase
Instead, install the latest version of libcouchbase, and get the couchbase php extension source code and compile it:
brew install https://github.com/couchbase/homebrew/raw/preview/Library/Formula/libcouchbase.rb git clone https://github.com/couchbase/php-ext-couchbase.git cd php-ext-couchbase/ phpize ./configure make make test sudo make install
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
sudo apachectl restart
and double check that the couchbase module is being shown when you do a `phpinfo();`