I’m trying to follow the code examples from http://docs.couchbase.com/sdk-api/couchbase-php-client-2.3.0/classes/Couchbase.ClassicAuthenticator.html
I’m working in one Docker image connecting to another (that extends the couchbase:4.6.1 image). I have setup admin credentials in the Dockerfile’s entrypoint:
curl -i -X POST http://127.0.0.1:8091/settings/web -d 'password=MYPASSWORD&username=MYUSER&port=SAME'
That works: I can log into the web portal using the credentials provided. However, using the PHP SDK has been rocky. In general, examples are needlessly hard to find, and examining the source code does not clarify things (others have posted about that already), but I have been able to create a bucket using the following code:
$cluster = new CouchbaseCluster('http://127.0.0.1:8091');
$manager = $cluster->manager('MYUSER', 'MYPASS');
$manager->createBucket('new_bucket');
That does produce the following warnings and errors:
[cb,WARN] (htconfig L:130 I:0) <couchbase:8091> (CTX=0x5601e6fd7e90,bc_http) Got 404 on config stream. Assuming terse URI not supported on cluster
[cb,EROR] (htconfig L:122 I:0) <couchbase:8091> (CTX=0x5601e6fd7e90,bc_http) Got 404 on config stream. Assuming bucket does not exist as we've tried both URL types
[cb,EROR] (htconfig L:142 I:0) <couchbase:8091> (CTX=0x5601e6fd7e90,bc_http) Got non-success HTTP status code 404
That actually WORKS – the bucket gets created, but I have to suppress errors and I have no idea what they mean. Ideas?
Trying to follow the code examples (listed in the link at top), I end up in Segmentation fault-land.
$authenticator = new \Couchbase\ClassicAuthenticator();
$authenticator->cluster('MYUSER', 'MYPASS');
$cluster = new \Couchbase\Cluster("http://127.0.0.1:8091");
$cluster->authenticate($authenticator);
$cluster->manager()->createBucket('my_bucket'); // Segmentation fault!
Any ideas? I’m a bit baffled as to why this flow isn’t even mentioned on the https://developer.couchbase.com/documentation/server/current/sdk/php/start-using-sdk.html page – bootstrapping the app via the SDK seems like the first thing you’d want to do.
Any guidance is appreciated.
PHP 7.1.11-1+ubuntu16.04.1+deb.sury.org+1