qkboy
qkboy

Reputation: 218

Failed to create IO instance of Couchbase

I just change Couchbase 2.0beta for using Views.So,I follow the offical manual to build couchbase php extsion. First,install a pure RHEL 6.2.Then,install couchbase-server-2.0.0-1723 and all dependent packages from libcouchbase:

libcouchbase2-dummy-2.0.0beta2-1.x86_64
couchbase-server-2.0.0-1723.x86_64
libcouchbase2-2.0.0beta2-1.x86_64
libcouchbase-devel-2.0.0beta2-1.x86_64
libev-4.03-3.el6.x86_64
libevent-1.4.13-1.el6.x86_64

Extract php-ext-couchbase-1.1.0-dp5-centos62-x86_64.tar.gz,copy couchbase.so to /usr/lib64/php/modules/,and edit /etc/php.d/json.ini:

extension=json.so
extension=couchbase.so

Finally,restart HTTP Server.Then,Check couchbase modules is lauch corrent by:

php -m|grep couchbase

and phpinfo() can output couchbase version is 1.1.0-dp5. All looks well,but I try to run php code:

<?php
$cb = new Couchbase("127.0.0.1:8091",'Administrator','redflag','default');
$cb->set('a',1);

It's wrong:

$ php getview.php
PHP Warning:  Couchbase::__construct(): failed to create IO instance in /var/www/html/getview.php on line 2
PHP Warning:  Couchbase::set(): unintilized couchbase in /var/www/html/getview.php on line 3

In order to check couchbase setup is right,I open Couchbase GUI by Administrator as username,redflag as password.Then,create new document,use REST API get item or Views.Those things are OK,no problem,except php code.

No other way out,I git from https://github.com/couchbase/php-ext-couchbase. Build new php-couchbase extsion,and try agin.But the problem is the same.

I find someone has the same error on here & this.Unfortunately there was't solutions. How can I use php-ext-couchbase 1.1dp5 modules?THX.

Upvotes: 1

Views: 444

Answers (2)

qkboy
qkboy

Reputation: 218

Use yum to install libcouchbase2-libevent package can solve this problem. BTW.While you run yum install libcouchbase-devel,it don't include libcouchbase2-libevent.If you miss that,you also can make & install php-ext-couchbase module with no error.But you can't connect Couchbase in php,as memtion above.

Upvotes: 1

daschl
daschl

Reputation: 1124

on a first glance it seems to load the couchbase extension properly. The thing that may be wrong here is how to access your bucket.

If you didn't do any changes, the "default" bucket has no password associated with it and in general the user of the bucket is the bucket name itself. So in the case of the "default" bucket, it would look like this:

$client = new Couchbase("127.0.0.1:8091", "default", "", "");

And if you have a password defined:

$client = new Couchbase("127.0.0.1:8091", "bucketname", "", "password");

Hope this helps, Michael

Upvotes: 1

Related Questions