How to confirm PHP SDK installed and working

Hi.

Out of curiosity. How can I confirm whether PHP SDK is installed successfully and can connect to couchbase server? I ran the whole installation with no error. But when I tried to connect to couchbase server using the example provided with beer-sample, i got no result.

Is there a way like the old php-ext-couchbase where you can see it installed when you ran info.php script? Please advise?

Can anyone who has done PHP SDK comment on this? Please help?

The information about the couchbase driver you had running with your php instance (referring to the older driver version) is no longer added with future releases. You can see this thread to see where this was brought up, before.

As far as the beer example stuff is concerned, I never tried using the default buckets for testing. I just made my own quick example to test connectivity.

Hope that helps.

Thanks for sharing Erutan.

I’m not sure why Couchbase didn’t let the driver register with php which we normally see when we run the info.php.

However saying that, when I tested the sdk (which by the way I have no idea which version it installed since I ran the pecl installation) the command since to be stuck at this line:

$myCluster = new CouchbaseCluster(‘couchbase://localhost’);

and getting very frustrated since I’m not sure how to move forward to the next one. Erutan, mind sharing with me your test php that you know works? Or anyone else out there? Please help? Many thanks…

Does this help you?

$cb = new CouchbaseCluster("127.0.0.1:8091");
var_dump($bucket = $cb->openBucket("main"));

Also, this may come in handy.

Thanks Erutan409. I’ll give it a shot this weekend. Also out of curiosity, where does couchbase store all the log in the posted link you sent to me? Trying to trace it down to get to the bottom of what’s up. Many thanks again for all of your help.

You’re welcome. Those are the codes that are returned with the CouchbaseException. So, you’d write your application to check which specific codes you were getting to handle said errors.

I basically had to reverse engineer the C code to figure out which code meant what, since it wasn’t documented anywhere; at least at the time when I posted that.

Well I found out why yours works and mine doesn’t. It has something to do with the port. As we all can see, the manual didn’t specifically mention port in their example.

http://docs.couchbase.com/developer/php-2.0/php-intro.html

$myCluster = new CouchbaseCluster(‘couchbase://localhost’);

I also tried both methodology where I put (‘couchbase://localhost:8091’) and just (‘localhost:8091’) per your example Erutan409 and both works just fine. I’m just curious why they both works and whether it has any resource implication to the code. Just curious. Many thanks again for your help Erutan409. You are a life safer and if you lived here where I live, I’ll buy you beer or whatever the poison you prefer… :smile:

Sorry for the late response, but I think it’s because it needs to the port. At least, that’s what it seems like to me.