LCB_BUCKET_ENOENT: The bucket requested does not exist

My PHP SDK code:

    private function search($request) {
        $cluster = new CouchbaseCluster('http://127.0.0.1:8093', 'root', '123456');
        $bucket  = $cluster->openBucket('teste', 'teste');
        $bucket->enableN1ql(array('http://127.0.0.1:8093'));
        $query = CouchbaseN1qlQuery::fromString("SELECT * FROM teste");
        $results = $bucket->query($query);
        return $results;
    }

Iḿ getting this:

Uncaught CouchbaseException: LCB_BUCKET_ENOENT: The bucket requested does not exist in [CouchbaseNative]/CouchbaseBucket.class.php:76
Stack trace:
#0 [CouchbaseNative]/CouchbaseBucket.class.php(76): _CouchbaseBucket->__construct('http://127.0.0....', 'teste', 'teste')
#1 [CouchbaseNative]/CouchbaseCluster.class.php(70):  CouchbaseBucket->__construct('http://127.0.0....', 'teste', 'teste', NULL)

Iḿ using both Couchbase and PHP SDK last version.

Thanks to advance.

you cannot use use N1QL endpoint as cluster configuration endpoint, it should be couchbase://localhost

This is not necessary anymore

you have to quote bucket name like this

SELECT * FROM `teste`

Ok, Im doing this:

        $cluster = new CouchbaseCluster('couchbase://localhost:8093', 'root', '123456');
        $bucket  = $cluster->openBucket('travel-sample');
        $query = CouchbaseN1qlQuery::fromString("SELECT * FROM `travel-sample`");
        $results = $bucket->query($query);

And im getting this now:

Uncaught CouchbaseException: LCB_CONNECT_ERROR: Error while establishing
 TCP connection. 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:76
Stack trace:
#0 [CouchbaseNative]/CouchbaseBucket.class.php(76): 
_CouchbaseBucket->__construct('couchbase://loc...', 'travel-sample', 
'')
#1 [CouchbaseNative]/CouchbaseCluster.class.php(70): 
CouchbaseBucket->__construct('couchbase://loc...', 'travel-sample', 
'', NULL)

you cannot use use N1QL endpoint as cluster configuration endpoint, it should be couchbase://localhost

@avsej Thanks. Its because the port 8091 was not open on my system. I dont know why. I openned that and I did > $cluster = new CouchbaseCluster(‘couchbase://localhost’, ‘root’, ‘123456’);
and worked!

Thanks a lot!!

Can you just help me with somethig else? How I create primary index?

Thanks again!

CREATE PRIMARY INDEX ON `travel-sample`

http://developer.couchbase.com/documentation/server/current/n1ql/n1ql-language-reference/createprimaryindex.html

Thank you very much!!