pecl install cassandra
产生错误:
配置:错误:无法加载 libcassandra
错误:`/tmp/pear/temp/cassandra/configure' 失败
此错误消息是 SO 上另一个问题的主题,但尚未解决:Installing php datastax driver on ubuntu
有人可以帮忙吗?
pecl install cassandra
产生错误:
配置:错误:无法加载 libcassandra
错误:`/tmp/pear/temp/cassandra/configure' 失败
此错误消息是 SO 上另一个问题的主题,但尚未解决:Installing php datastax driver on ubuntu
有人可以帮忙吗?
您缺少 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
我尝试使用php-driver和cpp-driver在 Ubuntu 14.04.1 LTS for PHP 5.5.9 上为 php 安装 cassandra 驱动 程序,如下所示,
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
对于 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:安装步骤是:
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
对于 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~~
)。
这在 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 已被弃用,我更新了以前的帖子:
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