如何安装PHP扩展libzookeeper

PHP扩展libzookeeper(https://github.com/Timandes/libzookeeper)主要用于使用PHP代码连接Zookeeper集群。

扩展对原Zookeeper C Client(https://zookeeper.apache.org/)的功能进行了简化,强调简单性与易用性。

同时,本着开放的精神,允许更多的参与到Zookeeper的开发与使用当中。

libzookeeper扩展依赖于Zookeeper C Client,后者包含在Zookeeper的安装包中,具体安装方法参看:https://zookeeper.apache.org/doc/r3.5.0-alpha/zookeeperProgrammers.html#Installation。

下面介绍libzookeeper的安装步骤(以v0.3.1为例):

1)下载并解压缩安装包:

wget https://github.com/Timandes/libzookeeper/archive/v0.3.1.tar.gz libzookeeper-0.3.1.tar.gz

tar xvf libzookeeper-0.3.1.tar.gz

2)编译并安装扩展:

cd libzookeeper-0.3.1

phpize

./configure --with-libzookeeper=/path/to/zookeeper_c_client

make

make install

其中,/path/to/zookeeper_c_client代表已安装好的Zookeeper C Client的路径。

3)编辑php.ini,插入如下代码行:

extension=libzookeeper.so

4)如果使用PHP-FPM,则需要重启该服务:

service php-fpm restart

5)检查扩展加载情况:

php -m | grep libzookeeper

 

在安装过程中出现任何问题,均可以前往https://github.com/Timandes/libzookeeper发问。

 

posted @ 2015-08-15 17:34  zookeeper  阅读(4592)  评论(0编辑  收藏  举报