How can I connect couchbase with app remote by php


#1

Hi There,

I’m a new player with in nosql, so I was created a virtual server 2 nodes install couchbase server are called node-0, node-1 and one webserver. In a webserver I was install php sdk 2.1 already and connect with php script with command line it worked. But when I entered from web access to webserver I got an error below:

Fatal error: Uncaught exception ‘CouchbaseException’ with message ‘Generic network failure. Enable detailed error codes (via LCB_CNTL_DETAILED_ERRCODES, or via detailed_errcodes in the connection string) and/or enable logging to get more information’ in [CouchbaseNative]/CouchbaseBucket.class.php:74 Stack trace: #0 [CouchbaseNative]/CouchbaseBucket.class.php(74): _CouchbaseBucket->__construct(‘couchbase://nod…’, ‘test’, ‘’) #1 [CouchbaseNative]/CouchbaseCluster.class.php(61): CouchbaseBucket->__construct(‘couchbase://nod…’, ‘test’, ‘’) #2 /var/www/html/index.php(7): CouchbaseCluster->openBucket(‘test’) #3 {main} thrown in [CouchbaseNative]/CouchbaseBucket.class.php on line 74

So I try to ran the php on the command line it’s worked! Now I don’t understand what kind of difference on remote web access and command line? and can I use a access by webpage.

<?php

$cluster = new CouchbaseCluster(‘couchbase://node-0’,‘username’,‘password’);
$bucket = $cluster->openBucket(‘test’);
$res = $bucket->get(‘Username’);
var_dump($res);

?>

Thanks in advance.