Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing php datastax driver on ubuntu

I am trying to install the datastax php driver for Cassandra and when i run the following command:

pecl install ext/package.xml

after checking it out of git i get the following message:

configure: error: Unable to load libcassandra

ERROR: `/tmp/pear/temp/cassandra/configure' failed

Can anyone point me in the right direction in order to successfully install this driver please?

version of cassandra i am using is 2.1.8 so maybe the driver has not been updated to connect to the latest version of cassandra.

like image 908
Moshi Avatar asked Aug 05 '15 17:08

Moshi


1 Answers

The following steps worked for me. YMMV.

$ uname -a
3.2.0-4-amd64 #1 SMP Debian 3.2.68-1+deb7u3 x86_64 GNU/Linux

Install some prereqs (removed libuv-dev from the list):

$ sudo apt-get install g++ make cmake libssl-dev libgmp-dev php5 php5-dev openssl libpcre3-dev

Trying to install libuv-dev right now will result in the following error:

libuv depends on libc6 (>= 2.14); however: Version of libc6:amd64 on system is 2.13-38+deb7u8.

Wheezy seems to have a slightly older version of libc6. Step up to Jessie to get 2.14. Add the following to /etc/apt/sources.list:

deb ftp://ftp.debian.org/debian/ jessie main
deb-src ftp://ftp.debian.org/debian/ jessie main

After running the following commands, these services will be restarted: mysql, exim4, cups, cron, atd, apache2

$ sudo apt-get update
$ sudo apt-get install libc6
$ sudo apt-get -f install

Download and install the following files:

$ wget http://downloads.datastax.com/cpp-driver/ubuntu/14.04/libuv_1.6.1-1_amd64.deb
$ wget http://downloads.datastax.com/cpp-driver/ubuntu/14.04/libuv-dev_1.6.1-1_amd64.deb
$ wget http://downloads.datastax.com/cpp-driver/ubuntu/14.04/cassandra-cpp-driver_2.1.0-1_amd64.deb
$ wget http://downloads.datastax.com/cpp-driver/ubuntu/14.04/cassandra-cpp-driver-dev_2.1.0-1_amd64.deb
$ sudo dpkg -i libuv_1.6.1-1_amd64.deb
$ sudo dpkg -i libuv-dev_1.6.1-1_amd64.deb
$ sudo dpkg -i cassandra-cpp-driver_2.1.0-1_amd64.deb
$ sudo dpkg -i cassandra-cpp-driver-dev_2.1.0-1_amd64.deb

Download and install the DataStax Cassandra PHP extension:

$ git clone https://github.com/datastax/php-driver.git
$ cd php-driver
$ sudo pecl install ext/package.xml 

Add the extension to php.ini:

$ sudo sh -c 'echo "extension=cassandra.so" >>/etc/php5/apache2/php.ini'

Restart Apache:

$ sudo /etc/init.d/apache2 restart

Confirm Cassandra appears using <?php phpinfo();

like image 143
paing Avatar answered Nov 14 '22 06:11

paing