Can't connect to couchbase via php.

Hi all.

I have this strange issue that I'm banging my heads off. It works on dev machine but when I moved it to prod machine, I got this error:

FastCGI-stderr: PHP Fatal error: Uncaught exception 'CouchbaseLibcouchbaseException' with message 'Failed to create libcouchbase instance: Administrator account must not be used to access the data in the bucket' in /var/www/myapps/Bootstrap.php:149

This is line 149:
$couchbase = new Couchbase($db['host'],$db['username'],$db['password'], $db['dbname']);

Did I miss something? I turn off all my firewall and selinux to make sure it's not their issue. Still the same..

I'm using:
CentOS 6.4 64Bit
Couchbase 2.01
whatever the php-ext-couchbase define in this repo:
http://packages.couchbase.com/rpm/couchbase-centos62-x86_64.repo

I can login with no issue via browser with the same username and password.

The question is, is this really an account issue? If it is then how or where do I create another user? Can't seem to find it anywhere in the documentation.

If not, any suggestion on how I should debug this? Please help?

1 Answer

« Back to question.

Hello,

Based on the following error

FastCGI-stderr: PHP Fatal error: Uncaught exception 'CouchbaseLibcouchbaseException' with message 'Failed to create libcouchbase instance: Administrator account must not be used to access the data in the bucket' in /var/www/myapps/Bootstrap.php:149

I think you are connecting from your application using the "Administrator" user and password. You cannot use the Administrator user to connect to your bucket.

If you bucket is not protected by a SASL password you only need to pass the bucket name, something like

$cb = new Couchbase('localhost:8091', '', '', 'default', TRUE);

If your bucket is protected by a SASL Password just send it:

$cb = new Couchbase('localhost:8091', '', 'password', 'demo', TRUE);

So if you change your connection string everything should work as expected.

Regards
Tug
@tgrall