Uncaught exception 'CouchbaseLibcouchbaseException' with message 'Failed to create libcouchbase instance'

I've installed the repo using sudo wget -O/etc/yum.repos.d/couchbase.repo http://packages.couchbase.com/rpm/couchbase-centos62-x86_64.repo

Then I've installed the packages through yum

yum install -y libcouchbase2-libevent libcouchbase-devel

i've then called yum install pecl

everything seems to install fine, yet if I run the following php :

$cb = new Couchbase("192.168.0.70:8091", "admin", "password", "default");
$cb->set("a", 1);
$a = $cb->get("a");
echo $a;

I get the following :

PHP Fatal error: Uncaught exception 'CouchbaseLibcouchbaseException' with message 'Failed to create libcouchbase instance'

i've disabled selinux, rebooted the machine, but the problem still persists.

php reports the following

couchbase support => enabled
version => 1.1.4dp1
libcouchbase version => 2.1.3
json support => yes
fastlz support => yes
zlib support => yes
igbinary support => no

Directive => Local Value => Master Value
couchbase.compression_factor => 1.3 => 1.3
couchbase.compression_threshold => 2000 => 2000
couchbase.compressor => none => none
couchbase.config_cache => no value => no value
couchbase.durability_default_poll_interval => 100000 => 100000
couchbase.durability_default_timeout => 40000000 => 40000000
couchbase.instance.persistent => On => On
couchbase.restflush => On => On
couchbase.serializer => php => php
couchbase.view_timeout => 75 => 75

Any Ideas on how to resolve the issue? I've even tried a fresh install of centos 6.4 with just php and couchbase, and it still shows the error message.

1 Answer

« Back to question.

do not use accounts with administrator permissions to perform data operations. you should either pass NULL as the username or name of the bucket

I was wondering why it worked for me before with username and password, but it would seem after me reading some documentation that the 'default' bucket doesn't require a username and password for authentication! Many thanks!

it was working because libcouchbase was using undocumented feature of the cluster, and it allowed to connect using administrative permissions.

So this exception is misleading, isn't it?

I had the same problem and changing the login info to

     $cb = new Couchbase("127.0.0.1:8091", "default", "", "default");

worked for me. using the value "null" works too.
Using a password broke it with

Failed to establish libcouchbase connection to server: Authentication error

I think it would be better to give an error message stating that Admin logins are not allowed is better than this exception 'Failed to create libcouchbase instance'.

in current php extension version the exception just doesn't carry detailed explanation. next version will fix that.

Please ignore previous Comment, just found
Found http://www.couchbase.com/communities/q-and-a/solved-ubuntu-1310-php-553-...

which is the same issue and announces a patch to fix this...

Sorry...