Sometimes CouchbaseBucket::query() returns null


#1

I have a web project that I call a view with CouchbaseBucket::query function with PHP SDK as below:

$myCluster = new CouchbaseCluster('couchbase://127.0.0.1');
$myBucket = $myCluster->openBucket('devbucket');
$query = CouchbaseViewQuery::from('dev_span_view', 'spanView');
$res = $myBucket->query($query);

Sometimes the query() returns null, but when I refresh the webpage the query() function will fill the $res variable with documents from the view. After a few times refreshing the webpage again query() returns null.
I looked at the Log section in CouchBase admin panel, but nothing useful was found there.
How can I figure out what is the problem?

I’m on Ubuntu 14.04, Couchbase 3.0.1

Regards,
Hadu


#2

Which version of the PHP SDK were you using?

Also, if it’s easy to test, you may want to turn on verbose logging from libcouchbase which will help you see what’s happening underneath.


#3

i’m using PHP SDK v2.0.1.
Thanks, I’ll try it, and would you please mention what would be the path for ‘log’ file after turning on the verbose mode?


#4

The log goes to STDERR by default, so it depends a bit on how you’re running PHP. If as an Apache module, probably to the httpd.err log file. Is that correct @brett19 ?


#5

I turned on couchbase verbose mode with this command (should I restart the CB server?)

$ LCB_LOGLEVEL=5

I looked at /var/log/apache2/error.log but nothing useful was logged in.
I’m looking for something like Sync Gateway log file /home/sync_gateway/logs/sync_gateway_error.log which logs every activity.
Is there something similar for CouchBase server?


#6

You don’t need to restart Couchbase Server. You should however ensure logging is in effect.

There is another undocumented way to enable logging, the using console_log_level option in the connection string. Its value is the same as you would provide to the environment. You can use this temporarily if you are finding it difficult to pass environment variables to your PHP process.