Install Zookeeper PHP Extension
The following tutorial will install the Zookeeper extension for PHP and has been tested on Ubuntu 14.04 and Debian 8.
Steps
Firstly, we need to manually install Zookeeper. You can go here to grab the latest version/link, which at the time of writing this tutorial is 3.4.8. This will result in us having the headers which prevented us from being able to use other solutions to install the extension.
sudo apt-get install php5-dev -y
wget ftp://ftp.mirrorservice.org/sites/ftp.apache.org/zookeeper/zookeeper-3.4.8/zookeeper-3.4.8.tar.gz
tar --extract --gzip --file zookeep*
cd zookeeper-*
cd src/c
./configure --prefix=/usr/
make
sudo make install
Now that we have zookeeper installed, we can compile the php extension.
cd $HOME
sudo apt-get install git -y
git clone https://github.com/andreiz/php-zookeeper.git
cd php-zookeeper
phpize
./configure
make
sudo make install
We've compiled the PHP extension, now we just need to add it to PHP by executing the following command:
sudo echo "extension=zookeeper.so" | \
sudo tee -a /etc/php5/cli/conf.d/20-zookeeper.ini
That's it! Run the following command to check that everything installed correctly:
php -m | grep zookeeper
You should see the following output:
zookeeper
References
- Distributed application in PHP with Apache Zookeeper
- Github andreiz/php-zookeeper - Error while installing #63
- Github - install php zookeeper extension
First published: 16th August 2018