Php-ext-couchbase on Centos 6.4 Failed


#1

Hi all.

I’m trying to install the php-ext-couchbase with Centos 6.4 64bit. I followed all the instruction including trying the pecl install option. I have googled every possibility and I’m still getting this error.

php -m | grep couchbase

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/couchbase.so' - /usr/lib64/php/modules/couchbase.so: undefined symbol: php_json_encode in Unknown on line 0

Is it because I’m installing it on 6.4 64 bit since I haven’t find any comment from anyone who has successfully done it in Centos 6.4. Please help?


#2

I guess I’m going to try to answer my own question after hours of trial and error. The steps I took doesn’t make any sense at all but somehow it works so I’m not going to spend time trying to figure out why. I have replicated these steps in 2 different servers and they both works after these steps…

Installing Couchbase Server

First remove php-devel (don’t know why but it seems to work this way). Here is the reference:
https://bugs.php.net/bug.php?id=59548

yum remove php-devel
yum install -y openssl098e
rpm -ivh http://packages.couchbase.com/releases/2.0.1/couchbase-server-community_x86_64_2.0.1.rpm

go to your couchbase web browser at: “http://yourhost:8091” and configure it.

Now installing the Php-extension

yum install -y php-devel

wget -O /etc/yum.repos.d/couchbase.repo http://packages.couchbase.com/rpm/couchbase-centos62-x86_64.repo

yum install -y  libcouchbase2 libcouchbase-devel libcouchbase2-libevent
pecl install couchbase

echo "extension=couchbase.so" >> /etc/php.d/json.ini

That’s it. Voila… It works. So I thought I share this with whoever can make use of it… Good luck…


#3

I had many errors if json extension occurred after couchbase extension. Thus the correct order is:
json
couchbase


#4

Hey Guys,

Just to clarify, in non-recent versions of PHP, the interpreter was not able to automatically determine extension inter-dependancy, meaning that it was left to the user. In our case, Couchbase is dependant on the JSON extension, and thus it is unfortunately necessary to enforce the couchbase extension loading after the JSON extension, rather than being arbitrarily located in the load order.

Note that using the SDK with newer versions of the PHP interpreter solves this problem, as does using the 2.0 SDK on any PHP version, as we now make dynamic use of the JSON extension.

Cheers, Brett