Home > Backend Development > PHP Tutorial > 如何安装PHP扩展libzookeeper

如何安装PHP扩展libzookeeper

WBOY
Release: 2016-06-23 13:28:35
Original
1310 people have browsed it

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发问。

 

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template