Couchbase connection errors


In the last 24 hours, despite catching every Couchbase exception listed, I’m getting hundreds of the following errors (as PHP notices):

Failed to establish libcouchbase connection to server: Connection failure

  • this is when doing normal gets and view queries in the website
    There is no active connection to couchbase
  • this is coming from the custom session handler

There are three servers set up when Couchbase() is initialised.

Is there a reason for these errors? Is there a way to handle them?

Is there a correct way to test for an active connection rather that doesn’t generate an error like this?

I’ve tried using if($cb instanceof Couchbase){ // do code }else{ // retry connection } but that still doesn’t seem to work.

Some system figures for you:

3 web servers:

  • 3.1GHz processor
  • 4GB RAM
  • 300GB HDD
  • Ubuntu 12.04.1 LTS

2 CB servers:

  • 3.1GHz processor
  • 8GB RAM
  • 1TB HDD
  • Ubuntu 12.04.2 LTS

1 CB server:

  • 3.1GHz processor
  • 8GB RAM
  • 500GB HDD
  • Debian 6.0.7

Using PHP 5.3.10 with Suhosin-Patch on all web servers with Couchbase plugin 1.1.2 installed.

Is this something that has been come across before? Is there a newer version of the plugin available?

Do you know what the cause of the issue is? How does the plugin detect and handle potentially unavailable servers? Does it retry the other machines? Does it always use the first server in the list or is it random or otherwise?

Any advice greatly appreciated.



I know how frustrating it can be getting the SDK installed on your machine.

  1. Are you running redhat/centos or debian/ubuntu?

2.did you download the or did you do the pear method to install?


Thanks for the reply.

The operating systems are in the OP.

The PHP extension was downloaded via git following these instructions:

git clone
cd ./php-ext-couchbase
wget -O/etc/apt/sources.list.d/couchbase.list
apt-get update && apt-get install -y --force-yes libcouchbase2 libcouchbase-dev
make test
make install
echo “extension=/usr/lib/php5/[VERSION]/” > /etc/php5/apache2/conf.d/couchbase.ini
service apache2 restart

in your <?php phpinfo(); ?>

does Couchbase appear?


Perhaps I wasn’t clear in OP, but the Couchbase extension exists and is working the majority of the time but on many occassions I am getting these errors that there is no active connection in my php error logs.

It’s not a fatal error, it’s a notice, but it still implies that something somewhere isn’t working as it should, either my code or the extension itself.

In terms of the nodes, afaik they have been healthy throughout the time of these errors.

I get these notice errors too when I still can connect and do operation and run script via CRON tab. The fix is to set the correct file path correctly which you did … hmmmm

There had been some exception handling issues in the earlier 1.1.x releases, but all known ones are cleaned up as of 1.1.5. Can you upgrade to 1.1.5? It’s all fixes, so it shouldn’t introduce any issues.