How to install gearman extension in php7 running on ubuntu 18.04

2.9k Views Asked by At

I am currently required to setup the new server running php7.2 and the server will have many background process for sending emails to customer. the recommendation I got was to use Gearman Job Server. I have been searching but seems to have only post about gearman-job-server with php5 and below.

2

There are 2 best solutions below

0
Ruberandinda Patience On

The process of installing Gearman Job Server with php7 will be covered in like 4 steps

Install and update the Gearman PPA sudo apt-get install software-properties-common sudo add-apt-repository ppa:gearman-developers/ppa sudo apt-get update

Install Gearman Job Server and some other required components and tools sudo apt-get install gearman-job-server libgearman-dev php7.0-dev php-pear wget unzip re2c sudo apt-get upgrade

Download, compile the gearman pecl module and add to php.ini cd /tmp/ sudo wget https://github.com/wcgallego/pecl-gearman/archive/master.zip unzip master.zip cd pecl-gearman-master sudo phpize ./configure sudo make sudo make install echo "extension=gearman.so" | sudo tee /etc/php/7.0/mods-available/gearman.ini sudo phpenmod -v ALL -s ALL gearman

Restart webserver or PHP FPM sudo service php7.0-fpm restart sudo service apache2 restart

If you are running a different version of PHP make sure you make the appropriate changes to the commands or directories mentioned above. ie “/etc/php/7.0/” to “/etc/php/7.1/” etc.

Thanks to techearl.com for their tutorial which can be found Here

0
Colin Pickard On

The answer by Ruberandinda Patience is correct and will work but since the gearman pecl module is packaged for Ubuntu there is a much simpler way to achieve the same thing:

apt install gearman-job-server php-gearman