[SOLVED] Ubuntu 13.10 + PHP 5.5.3 + LibCouchBase 2.1.3 + PHP CouchBase Client 1.1.5 (1.1.4dp1) = CouchbaseLibcouchbaseException

Hello Cool CouchBase'ers

We are currently upgrading our CouchBase development machines and installing the lastest version of Ubuntu Desktop (13.10) and applying our usual DevBox configuration management to these machines.

We have noticed some interesting behaviour and are wondering if this has been observed in the labs or on anyone else's server configuration.

Ubuntu 13.10 by default installs the newer version of PHP (PHP Version 5.5.3-1ubuntu1).

We installed the Couchbase PHP SDK client as we normally would using PECL.

sudo pecl install couchbase

Installation goes fine. We find we need to add the recommended lines to php.ini in both the /etc/php5/cli/php.ini and /etc/php5/fpm/php.ini to work around the issue of the couchbase module loading before the json module.


Running php -m on the command line produces the json warning, however I can see that the couchbase module has loaded. All is looking mighty fine... until we execute the php code.

When the php code is trying to instantiate the new Couchbase object,
$cb = new Couchbase($node, $account, $password, $bucket, true);
it throws the following error

Failed to create libcouchbase instance.

Output of ldd /usr/lib/php5/20121212/couchbase.so is pasted below.

	linux-vdso.so.1 =>  (0x00007fff66ffe000)
	libcouchbase.so.2 => /usr/lib/libcouchbase.so.2 (0x00007f2936d20000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f2936b07000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f293673f000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f293643b000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f2936237000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f2937190000)

I would like to understand the possible cause and too troubleshoot this issue with some help from the cool CouchBase community. We would love to get our development machine onto 5.5.3 of PHP and help anyone else in the future who may be experiencing a similar error.

Can anyone recommend some trouble shooting steps that we could try to get the CouchBase PHP SDK client and the CouchBase C libraries creating a libcouchbase instance object ?

1 Answer

« Back to question.

Could you verify that you are using the _exact_ same value for "username" and "bucket". Previous versions of libcouchbase allowed you to connect to the cluster with a different username than the bucket you wanted to use (for instance connect with administrator to operate on bucket "foo"). This isn't something we think is a good practice to use (its similar to log into your unix system as root to su to the user you want to use), so it was decided to deny that usage. Unfortunately the error code (and message) isn't correctly being propagated back to the user in PHP (there is a patch that will be part of the next release of the PHP extension).