pecl install cassandra throws: "error: Unable to load libcassandra"

Tobias Gassmann picture Tobias Gassmann · Oct 7, 2015 · Viewed 8.4k times · Source
pecl install cassandra

produces an error:

configure: error: Unable to load libcassandra

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

This error message is subject of another question here on SO, but has not been resolved: Installing php datastax driver on ubuntu

Can anybody help?

Answer

rock-ass picture rock-ass · Oct 19, 2015

You are missing cassandra C++ driver. I have run into the same issue on Ubuntu 14.04. I have done the following and it worked for me:

Prerequisites (Ubuntu 14.04):

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

Download the following packages:

wget http://downloads.datastax.com/cpp-driver/ubuntu/16.04/dependenices/libuv/v1.8.0/libuv_1.8.0-1_amd64.deb
wget http://downloads.datastax.com/cpp-driver/ubuntu/16.04/dependenices/libuv/v1.8.0/libuv-dev_1.8.0-1_amd64.deb
wget http://downloads.datastax.com/cpp-driver/ubuntu/16.04/v2.4.1/cassandra-cpp-driver_2.4.1-1_amd64.deb
wget http://downloads.datastax.com/cpp-driver/ubuntu/16.04/v2.4.1/cassandra-cpp-driver-dev_2.4.1-1_amd64.deb

Install them in this order using dpkg:

sudo dpkg -i libuv_1.8.0-1_amd64.deb
sudo dpkg -i libuv-dev_1.8.0-1_amd64.deb
sudo dpkg -i cassandra-cpp-driver-dev_2.4.1-1_amd64.deb
sudo dpkg -i cassandra-cpp-driver_2.4.1-1_amd64.deb

You should be able to install cassandra using pecl. Don't forget to add extension=cassandra.so to your php.ini file and restart php process.

Based on an answer in the discussion you linked before.