Linux, php

Install Gearman Module to Ubuntu Xenial with PHP 7

The Gearman PHP module is the last piece of dependency missing in our stack before we can consider moving to PHP7. I’m currently testing Ubuntu 16.04 Xenial on PHP7 and unfortunately, the gearman module is not yet available on official repo. To proceed testing, I just compile it in my Docker image.

I’m installing the Gearman client on top of my existing PHP7 + Apache container on Docker hub: https://hub.docker.com/r/lysender/php7-apache/.

The idea to compile it is based on this thread: https://github.com/hjr3/pecl-gearman/issues/12.

Here is the additional commands to run to install the Gearman module.

# Install additional packages for compiling
apt-get -y install wget unzip re2c libgearman-dev

# Install from source
mkdir -p /tmp/install
cd /tmp/install
wget https://github.com/wcgallego/pecl-gearman/archive/master.zip
unzip master.zip
cd pecl-gearman-master
phpize
./configure
make install
echo "extension=gearman.so" > /etc/php/7.0/mods-available/gearman.ini
phpenmod -v ALL -s ALL gearman
rm -rf /tmp/install/pecl-gearman-master
rm /tmp/install/master.zip

# Verify if module is really installed
php -m | grep gearman

While waiting for the official release, will live with manually compiling it.

Enjoy and share!

2 thoughts on “Install Gearman Module to Ubuntu Xenial with PHP 7”

Leave a reply

Your email address will not be published. Required fields are marked *