How to Install CouchBase 2.0.1 Enterprise Server on Centos with php-ext-couchbase.

Couchbase is a simple, fast and elastic document-oriented database.

Installing Couchbase 

# yum -y groupinstall "Development Tools"
# yum -y install openssl098e
# wget
# rpm --install couchbase-server-enterprise_x86_64_2.0.1.rpm
Browse the URL : http://localhost:8091/ and finish the installation steps.(Will post these steps with all imagest very soon :))

Installing PHP

# yum -y install php
# yum -y install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-magickwand php-magpierss php-mapserver php-mbstring php-mcrypt php-mhash php-mssql php-shout php-snmp php-soap php-tidy

Installing php-ext-couchbase

# wget -O /etc/yum.repos.d/couchbase.repo
# yum install -y libcouchbase2 libcouchbase-devel libcouchbase2-libevent
# wget
# tar -xvf php-ext-couchbase-1.1.2-centos62-x86_64.tar.gz
# cd php-ext-couchbase
# cp /usr/lib64/php/modules
# echo "" >> /etc/php.d/josn.ini
# /etc/init.d/httpd restart

To verify the php extension

# php -m | grep couchbase
Output: couchbase

Some basic usage:

Let’s create 10 JSON documents and store them in Couchbase:


$connection = new Couchbase("");

for($i=0;$i<10;$i++) {
$doc = array(
'title' => "This is Post $i"
$connection->set("post_$i", json_encode($doc));


You can view your stored documents instantly through the GUI (http://localhost:8091/index.html#sec=documents&bucketName=default). Now we can retrieve all documents again by their keys:


$connection = new Couchbase("");

echo "<ul>";
for($i=0;$i<10;$i++) {
$post = json_decode($connection->get("post_$i"));
echo "<li>" . $post->title .  "</li>";
echo "</ul>";

%d bloggers like this: