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!

This entry was posted in Linux, php and tagged , . Bookmark the permalink.

Related Posts

2 Responses to Install Gearman Module to Ubuntu Xenial with PHP 7

  1. Thanks, saved me a lot of time. One additional step I needed to do was to install php7.0-dev

  2. Burak Özalp says:

    Thanks a lot, it works perfectly!

Leave a Reply

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