pecl install cassandra throws: "error: Unable to load libcassandra"
pecl install cassandra throws: "error: Unable to load libcassandra"
pecl install cassandra
产生错误:
configure: error: Unable to load libcassandra
ERROR: `/tmp/pear/temp/cassandra/configure' failed
此错误消息是 SO 上另一个问题的主题,但尚未解决:
有人可以帮忙吗?
您缺少 cassandra C++ 驱动程序。我在 Ubuntu 14.04 上遇到了同样的问题 运行。我做了以下并且对我有用:
先决条件(Ubuntu 14.04):
sudo apt-get install php-pear php5-dev libgmp-dev libpcre3-dev g++ make cmake libssl-dev openssl
下载以下软件包:
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
使用 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
您应该能够使用 pecl 安装 cassandra。
不要忘记将 extension=cassandra.so
添加到您的 php.ini 文件并重新启动 php 进程。
基于您之前链接的讨论中的答案。
这就是我让它工作的方式(在 debian 上):
sudo apt-get update
sudo apt-get install -y g++ git make cmake clang libssl-dev libgmp-dev php5-cgi php5-fpm php5 php5-dev openssl libpcre3-dev
sudo apt-get install libc6
sudo apt-get -f install
sudo curl http://downloads.datastax.com/cpp-driver/ubuntu/14.04/libuv_1.7.5-1_amd64.deb > /var/www/html/libuv_1.7.5-1_amd64.deb
sudo curl http://downloads.datastax.com/cpp-driver/ubuntu/14.04/libuv-dev_1.7.5-1_amd64.deb > /var/www/html/libuv-dev_1.7.5-1_amd64.deb
sudo curl http://downloads.datastax.com/cpp-driver/ubuntu/14.04/cassandra-cpp-driver_2.0.1-1_amd64.deb > cassandra-cpp-driver_2.0.1-1_amd64.deb
sudo curl http://downloads.datastax.com/cpp-driver/ubuntu/14.04/cassandra-cpp-driver-dev_2.0.1-1_amd64.deb > cassandra-cpp-driver-dev_2.0.1-1_amd64.deb
sudo dpkg -i libuv_1.7.5-1_amd64.deb
sudo dpkg -i libuv-dev_1.7.5-1_amd64.deb
sudo dpkg -i cassandra-cpp-driver_2.0.1-1_amd64.deb
sudo dpkg -i cassandra-cpp-driver-dev_2.0.1-1_amd64.deb
sudo pecl install cassandra
对于 Docker 的官方 PHP 机器:
cd /tmp
apt-get install php-pear php5-dev libgmp-dev libpcre3-dev g++ make cmake libssl-dev openssl
php -r '$files = ["http://downloads.datastax.com/cpp-driver/ubuntu/14.04/dependencies/libuv/v1.8.0/libuv_1.8.0-1_amd64.deb", "http://downloads.datastax.com/cpp-driver/ubuntu/14.04/dependencies/libuv/v1.8.0/libuv-dev_1.8.0-1_amd64.deb", "http://downloads.datastax.com/cpp-driver/ubuntu/14.04/v2.3.0/cassandra-cpp-driver_2.3.0-1_amd64.deb", "http://downloads.datastax.com/cpp-driver/ubuntu/14.04/v2.3.0/cassandra-cpp-driver-dev_2.3.0-1_amd64.deb"]; foreach($files as $file) { copy($file, basename($file)); }'
dpkg -i libuv_1.8.0-1_amd64.deb
dpkg -i libuv-dev_1.8.0-1_amd64.deb
dpkg -i cassandra-cpp-driver_2.3.0-1_amd64.deb
dpkg -i cassandra-cpp-driver-dev_2.3.0-1_amd64.deb
pecl install cassandra
echo 'extension=cassandra.so' > /usr/local/etc/php/conf.d/php-ext-cassandra.ini
然后重启容器(docker-compose restart ~~image~fpm~~
)。
对于 ubuntu 14.04:
安装步骤为:
sudo apt-get install php-pear php5-dev libgmp-dev libpcre3-dev g++ make cmake libssl-dev openssl
wget downloads.datastax.com/cpp-driver/ubuntu/14.04/dependencies/libuv/v1.8.0/libuv_1.8.0-1_amd64.deb
wget downloads.datastax.com/cpp-driver/ubuntu/14.04/dependencies/libuv/v1.8.0/libuv-dev_1.8.0-1_amd64.deb
wget downloads.datastax.com/cpp-driver/ubuntu/14.04/cassandra/v2.4.2/cassandra-cpp-driver_2.4.2-1_amd64.deb
wget downloads.datastax.com/cpp-driver/ubuntu/14.04/cassandra/v2.4.2/cassandra-cpp-driver-dev_2.4.2-1_amd64.deb
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_2.4.2-1_amd64.deb
sudo dpkg -i cassandra-cpp-driver-dev_2.4.2-1_amd64.deb
pecl install cassandra
ADD extension=cassandra.so in php.ini
restart the PHP process
对于CentOS 7,安装步骤为:
sudo yum update
sudo yum install automake cmake gcc gcc-c++ git libtool openssl-devel wget gmp gmp-devel boost php-devel pcre-devel git
pushd /tmp
wget http://dist.libuv.org/dist/v1.8.0/libuv-v1.8.0.tar.gz
tar xzf libuv-v1.8.0.tar.gz
pushd libuv-v1.8.0
sh autogen.sh
./configure
sudo make install
popd
popd
sudo curl http://downloads.datastax.com/cpp-driver/centos/7/dependencies/libuv/v1.8.0/libuv-1.8.0-1.el7.centos.x86_64.rpm
sudo curl http://downloads.datastax.com/cpp-driver/centos/7/dependencies/libuv/v1.8.0/libuv-devel-1.8.0-1.el7.centos.x86_64.rpm
sudo curl http://downloads.datastax.com/cpp-driver/centos/7/cassandra/v2.4.3/cassandra-cpp-driver-2.4.3-1.el7.centos.x86_64.rpm
sudo curl http://downloads.datastax.com/cpp-driver/centos/7/cassandra/v2.4.3/cassandra-cpp-driver-devel-2.4.3-1.el7.centos.x86_64.rpm
sudo rpm -ivh libuv-1.8.0-1.el7.centos.x86_64.rpm
sudo rpm -ivh libuv-devel-1.8.0-1.el7.centos.x86_64.rpm
sudo rpm -ivh cassandra-cpp-driver-2.4.3-1.el7.centos.x86_64.rpm
sudo rpm -ivh cassandra-cpp-driver-devel-2.4.3-1.el7.centos.x86_64.rpm
sudo yum update
sudo pecl install cassandra
sudo yum update
我尝试在 Ubuntu 14.04.1 LTS PHP 5.5.9 上安装 php 的 cassandra 驱动程序使用
php-driver and cpp-driver如下,
sudo apt-get install g++ clang make cmake libuv-dev libssl-dev git;
git clone https://github.com/datastax/cpp-driver.git
mkdir cpp-driver/build
cd cpp-driver/build
cmake ..
make
然后,
sudo apt-get install libgmp-dev php5 php5-dev openssl libpcre3-dev
pecl install cassandra
但是出错了,
checking for supported DataStax C/C++ driver version... nawk: cannot open /include/cassandra.h (No such file or directory)
configure: error: not supported. Driver version 2.4.2+ required (found )
ERROR: /tmp/pear/temp/cassandra/configure' failed
应对后,
cp cpp-driver/include/cassandra.h /usr/include/
又得到了一个,
checking for cass_cluster_new in -lcassandra... no
configure: error: Unable to load libcassandra
ERROR: /tmp/pear/temp/cassandra/configure' failed
经过大量研究,我得到了以下简单的解决方案,
sudo wget http://downloads.datastax.com/cpp-driver/ubuntu/14.04/dependencies/libuv/v1.8.0/libuv_1.8.0-1_amd64.deb
sudo wget http://downloads.datastax.com/cpp-driver/ubuntu/14.04/dependencies/libuv/v1.8.0/libuv-dev_1.8.0-1_amd64.deb
sudo wget http://downloads.datastax.com/cpp-driver/ubuntu/14.04/cassandra/v2.5.0/cassandra-cpp-driver-dev_2.5.0-1_amd64.deb
sudo wget http://downloads.datastax.com/cpp-driver/ubuntu/14.04/cassandra/v2.5.0/cassandra-cpp-driver_2.5.0-1_amd64.deb
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.5.0-1_amd64.deb
sudo dpkg -i cassandra-cpp-driver_2.5.0-1_amd64.deb
然后只需复制并启用扩展,
sudo vim /etc/php5/mods-available/cassandra.ini
extension=cassandra.so;
php5enmod cassandra
这对我在 Debian Jessie 上有效
apt-get remove libuv0.10-dev
git clone https://github.com/libuv/libuv.git
cd libuv
git reset --hard v1.19.1
sh autogen.sh
./configure
make
make check
sudo make install
git clone https://github.com/datastax/php-driver.git
cd php-driver
git submodule update --init
cd ext
./install.sh
vi /etc/php5/cli/php.ini
Add extension=cassandra.so
php -i | grep cassandra
因为 cantos Casandra 2.4.3 已被弃用,我更新了以前的 post:
sudo yum update
sudo yum install automake cmake gcc gcc-c++ git libtool openssl-devel wget gmp gmp-devel boost php-devel pcre-devel git
pushd /tmp
wget http://dist.libuv.org/dist/v1.8.0/libuv-v1.8.0.tar.gz
tar xzf libuv-v1.8.0.tar.gz
pushd libuv-v1.8.0
sh autogen.sh
./configure
sudo make install
popd
popd
sudo wget http://downloads.datastax.com/cpp-driver/centos/7/dependencies/libuv/v1.8.0/libuv-1.8.0-1.el7.centos.x86_64.rpm
sudo wget http://downloads.datastax.com/cpp-driver/centos/7/dependencies/libuv/v1.8.0/libuv-devel-1.8.0-1.el7.centos.x86_64.rpm
sudo wget https://downloads.datastax.com/cpp-driver/centos/7/cassandra/v2.8.0/cassandra-cpp-driver-2.8.0-1.el7.centos.x86_64.rpm
sudo wget https://downloads.datastax.com/cpp-driver/centos/7/cassandra/v2.8.0/cassandra-cpp-driver-devel-2.8.0-1.el7.centos.x86_64.rpm
sudo rpm -ivh libuv-1.8.0-1.el7.centos.x86_64.rpm
sudo rpm -ivh libuv-devel-1.8.0-1.el7.centos.x86_64.rpm
sudo rpm -ivh cassandra-cpp-driver-2.8.0-1.el7.centos.x86_64.rpm
sudo rpm -ivh cassandra-cpp-driver-devel-2.8.0-1.el7.centos.x86_64.rpm
sudo yum update
sudo pecl install cassandra
sudo yum update
pecl install cassandra
产生错误:
configure: error: Unable to load libcassandra
ERROR: `/tmp/pear/temp/cassandra/configure' failed
此错误消息是 SO 上另一个问题的主题,但尚未解决:
有人可以帮忙吗?
您缺少 cassandra C++ 驱动程序。我在 Ubuntu 14.04 上遇到了同样的问题 运行。我做了以下并且对我有用:
先决条件(Ubuntu 14.04):
sudo apt-get install php-pear php5-dev libgmp-dev libpcre3-dev g++ make cmake libssl-dev openssl
下载以下软件包:
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
使用 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
您应该能够使用 pecl 安装 cassandra。
不要忘记将 extension=cassandra.so
添加到您的 php.ini 文件并重新启动 php 进程。
基于您之前链接的讨论中的答案。
这就是我让它工作的方式(在 debian 上):
sudo apt-get update
sudo apt-get install -y g++ git make cmake clang libssl-dev libgmp-dev php5-cgi php5-fpm php5 php5-dev openssl libpcre3-dev
sudo apt-get install libc6
sudo apt-get -f install
sudo curl http://downloads.datastax.com/cpp-driver/ubuntu/14.04/libuv_1.7.5-1_amd64.deb > /var/www/html/libuv_1.7.5-1_amd64.deb
sudo curl http://downloads.datastax.com/cpp-driver/ubuntu/14.04/libuv-dev_1.7.5-1_amd64.deb > /var/www/html/libuv-dev_1.7.5-1_amd64.deb
sudo curl http://downloads.datastax.com/cpp-driver/ubuntu/14.04/cassandra-cpp-driver_2.0.1-1_amd64.deb > cassandra-cpp-driver_2.0.1-1_amd64.deb
sudo curl http://downloads.datastax.com/cpp-driver/ubuntu/14.04/cassandra-cpp-driver-dev_2.0.1-1_amd64.deb > cassandra-cpp-driver-dev_2.0.1-1_amd64.deb
sudo dpkg -i libuv_1.7.5-1_amd64.deb
sudo dpkg -i libuv-dev_1.7.5-1_amd64.deb
sudo dpkg -i cassandra-cpp-driver_2.0.1-1_amd64.deb
sudo dpkg -i cassandra-cpp-driver-dev_2.0.1-1_amd64.deb
sudo pecl install cassandra
对于 Docker 的官方 PHP 机器:
cd /tmp
apt-get install php-pear php5-dev libgmp-dev libpcre3-dev g++ make cmake libssl-dev openssl
php -r '$files = ["http://downloads.datastax.com/cpp-driver/ubuntu/14.04/dependencies/libuv/v1.8.0/libuv_1.8.0-1_amd64.deb", "http://downloads.datastax.com/cpp-driver/ubuntu/14.04/dependencies/libuv/v1.8.0/libuv-dev_1.8.0-1_amd64.deb", "http://downloads.datastax.com/cpp-driver/ubuntu/14.04/v2.3.0/cassandra-cpp-driver_2.3.0-1_amd64.deb", "http://downloads.datastax.com/cpp-driver/ubuntu/14.04/v2.3.0/cassandra-cpp-driver-dev_2.3.0-1_amd64.deb"]; foreach($files as $file) { copy($file, basename($file)); }'
dpkg -i libuv_1.8.0-1_amd64.deb
dpkg -i libuv-dev_1.8.0-1_amd64.deb
dpkg -i cassandra-cpp-driver_2.3.0-1_amd64.deb
dpkg -i cassandra-cpp-driver-dev_2.3.0-1_amd64.deb
pecl install cassandra
echo 'extension=cassandra.so' > /usr/local/etc/php/conf.d/php-ext-cassandra.ini
然后重启容器(docker-compose restart ~~image~fpm~~
)。
对于 ubuntu 14.04: 安装步骤为:
sudo apt-get install php-pear php5-dev libgmp-dev libpcre3-dev g++ make cmake libssl-dev openssl
wget downloads.datastax.com/cpp-driver/ubuntu/14.04/dependencies/libuv/v1.8.0/libuv_1.8.0-1_amd64.deb
wget downloads.datastax.com/cpp-driver/ubuntu/14.04/dependencies/libuv/v1.8.0/libuv-dev_1.8.0-1_amd64.deb
wget downloads.datastax.com/cpp-driver/ubuntu/14.04/cassandra/v2.4.2/cassandra-cpp-driver_2.4.2-1_amd64.deb
wget downloads.datastax.com/cpp-driver/ubuntu/14.04/cassandra/v2.4.2/cassandra-cpp-driver-dev_2.4.2-1_amd64.deb
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_2.4.2-1_amd64.deb
sudo dpkg -i cassandra-cpp-driver-dev_2.4.2-1_amd64.deb
pecl install cassandra
ADD extension=cassandra.so in php.ini
restart the PHP process
对于CentOS 7,安装步骤为:
sudo yum update
sudo yum install automake cmake gcc gcc-c++ git libtool openssl-devel wget gmp gmp-devel boost php-devel pcre-devel git
pushd /tmp
wget http://dist.libuv.org/dist/v1.8.0/libuv-v1.8.0.tar.gz
tar xzf libuv-v1.8.0.tar.gz
pushd libuv-v1.8.0
sh autogen.sh
./configure
sudo make install
popd
popd
sudo curl http://downloads.datastax.com/cpp-driver/centos/7/dependencies/libuv/v1.8.0/libuv-1.8.0-1.el7.centos.x86_64.rpm
sudo curl http://downloads.datastax.com/cpp-driver/centos/7/dependencies/libuv/v1.8.0/libuv-devel-1.8.0-1.el7.centos.x86_64.rpm
sudo curl http://downloads.datastax.com/cpp-driver/centos/7/cassandra/v2.4.3/cassandra-cpp-driver-2.4.3-1.el7.centos.x86_64.rpm
sudo curl http://downloads.datastax.com/cpp-driver/centos/7/cassandra/v2.4.3/cassandra-cpp-driver-devel-2.4.3-1.el7.centos.x86_64.rpm
sudo rpm -ivh libuv-1.8.0-1.el7.centos.x86_64.rpm
sudo rpm -ivh libuv-devel-1.8.0-1.el7.centos.x86_64.rpm
sudo rpm -ivh cassandra-cpp-driver-2.4.3-1.el7.centos.x86_64.rpm
sudo rpm -ivh cassandra-cpp-driver-devel-2.4.3-1.el7.centos.x86_64.rpm
sudo yum update
sudo pecl install cassandra
sudo yum update
我尝试在 Ubuntu 14.04.1 LTS PHP 5.5.9 上安装 php 的 cassandra 驱动程序使用 php-driver and cpp-driver如下,
sudo apt-get install g++ clang make cmake libuv-dev libssl-dev git;
git clone https://github.com/datastax/cpp-driver.git
mkdir cpp-driver/build
cd cpp-driver/build
cmake ..
make
然后,
sudo apt-get install libgmp-dev php5 php5-dev openssl libpcre3-dev
pecl install cassandra
但是出错了,
checking for supported DataStax C/C++ driver version... nawk: cannot open /include/cassandra.h (No such file or directory)
configure: error: not supported. Driver version 2.4.2+ required (found )
ERROR: /tmp/pear/temp/cassandra/configure' failed
应对后,
cp cpp-driver/include/cassandra.h /usr/include/
又得到了一个,
checking for cass_cluster_new in -lcassandra... no
configure: error: Unable to load libcassandra
ERROR: /tmp/pear/temp/cassandra/configure' failed
经过大量研究,我得到了以下简单的解决方案,
sudo wget http://downloads.datastax.com/cpp-driver/ubuntu/14.04/dependencies/libuv/v1.8.0/libuv_1.8.0-1_amd64.deb
sudo wget http://downloads.datastax.com/cpp-driver/ubuntu/14.04/dependencies/libuv/v1.8.0/libuv-dev_1.8.0-1_amd64.deb
sudo wget http://downloads.datastax.com/cpp-driver/ubuntu/14.04/cassandra/v2.5.0/cassandra-cpp-driver-dev_2.5.0-1_amd64.deb
sudo wget http://downloads.datastax.com/cpp-driver/ubuntu/14.04/cassandra/v2.5.0/cassandra-cpp-driver_2.5.0-1_amd64.deb
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.5.0-1_amd64.deb
sudo dpkg -i cassandra-cpp-driver_2.5.0-1_amd64.deb
然后只需复制并启用扩展,
sudo vim /etc/php5/mods-available/cassandra.ini
extension=cassandra.so;
php5enmod cassandra
这对我在 Debian Jessie 上有效
apt-get remove libuv0.10-dev
git clone https://github.com/libuv/libuv.git
cd libuv
git reset --hard v1.19.1
sh autogen.sh
./configure
make
make check
sudo make install
git clone https://github.com/datastax/php-driver.git
cd php-driver
git submodule update --init
cd ext
./install.sh
vi /etc/php5/cli/php.ini
Add extension=cassandra.so
php -i | grep cassandra
因为 cantos Casandra 2.4.3 已被弃用,我更新了以前的 post:
sudo yum update
sudo yum install automake cmake gcc gcc-c++ git libtool openssl-devel wget gmp gmp-devel boost php-devel pcre-devel git
pushd /tmp
wget http://dist.libuv.org/dist/v1.8.0/libuv-v1.8.0.tar.gz
tar xzf libuv-v1.8.0.tar.gz
pushd libuv-v1.8.0
sh autogen.sh
./configure
sudo make install
popd
popd
sudo wget http://downloads.datastax.com/cpp-driver/centos/7/dependencies/libuv/v1.8.0/libuv-1.8.0-1.el7.centos.x86_64.rpm
sudo wget http://downloads.datastax.com/cpp-driver/centos/7/dependencies/libuv/v1.8.0/libuv-devel-1.8.0-1.el7.centos.x86_64.rpm
sudo wget https://downloads.datastax.com/cpp-driver/centos/7/cassandra/v2.8.0/cassandra-cpp-driver-2.8.0-1.el7.centos.x86_64.rpm
sudo wget https://downloads.datastax.com/cpp-driver/centos/7/cassandra/v2.8.0/cassandra-cpp-driver-devel-2.8.0-1.el7.centos.x86_64.rpm
sudo rpm -ivh libuv-1.8.0-1.el7.centos.x86_64.rpm
sudo rpm -ivh libuv-devel-1.8.0-1.el7.centos.x86_64.rpm
sudo rpm -ivh cassandra-cpp-driver-2.8.0-1.el7.centos.x86_64.rpm
sudo rpm -ivh cassandra-cpp-driver-devel-2.8.0-1.el7.centos.x86_64.rpm
sudo yum update
sudo pecl install cassandra
sudo yum update