This extension uses libzookeeper library to provide API for communicating with ZooKeeper service.
ZooKeeper is an Apache project that enables centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services.
- ZooKeeper C Binding (>= 3.4)
- PHP (>= 7.0)
- Session extension (install with
--enable-session)
$ ./configure --prefix=/path/to/zookeeper-c-binding
$ make
$ sudo make installAs of ZooKeeper 3.5.0, after unpacking source tarball, the following command should be executed before above-metioned steps:
$ autoreconf -ifAs of ZooKeeper 3.5.9, the following command should be executed before autoreconf -if:
$ ant compile_juteAs of ZooKeeper 3.6.0, ant will fail because of missing build.xml. That file and two other files can be found in source tarball of 3.5.9:
$ cd apache-zookeeper-3.5.9
$ cp build.xml ivy* ../apache-zookeeper-3.6.2As of ZooKeeper 3.7.0, after unpacking source tarball, first execute the following command with Java 8 to build jute files:
$ mvn compileThen navigate to the C client directory and generate the configure file:
$ cd zookeeper-client/zookeeper-client-c
$ autoreconf -ifAfter that, you can proceed with the standard build steps mentioned above.
$ phpize
$ ./configure --with-libzookeeper-dir=/path/to/zookeeper-c-binding
$ make
$ sudo make install<?php
$zc = new Zookeeper();
$zc->connect('localhost:2181');
var_dump($zc->get('/zookeeper'));
?>Swoole\Async::set([
'enable_signalfd' => false, // See: https://github.com/swoole/swoole-src/issues/302
]);
$zk = new Zookeeper('localhost:2181');
Swoole\Process::signal(SIGTERM, function() {
echo "TERM" . PHP_EOL;
Swoole\Event::exit();
});
Swoole\Event::wait();- Install EditorConfig to your IDE.
- master: Main branch.
- 0.5.x: The last branch which still supports PHP 5.x.