Usually I would use pecl to install some additional PHP extensions on a cPanel server. This is a standard thing for all cPanel servers.
The syntax would be the following:
1 pecl install gearman
The same thing would go for your additional EA4 PHP versions, for example if you wanted to do that for PHP 5.5 you could use:
1 /opt/cpanel/ea-php55/root/usr/bin/pecl install gearman
However pecl does not yet have the gearman packages for PHP 7.x. So in order to install the extension we need to compile it from source.
Here are all of the steps that you would need to take. I would be doing this for PHP 7.0, the same steps would be valid for PHP 7.1 (Just change all references for php70 to php71).
Before starting with the compilation process itslef, I would suggest installing the gearman devel package:
12 yum install libgearmanyum install libgearman-devel
1. Create a temporary directory that would hold our source files:
12 mkdir gearman-70cd /usr/src/gearman-70
2. As I’ve tested this, I would use this git repo to get the gearman source files from.
3. Just download the files as normal:
1 git clone https://github.com/wcgallego/pecl-gearman.git
4. The access the folder containing the source files:
1 cd pecl-gearman
5. Then use the following command here:
1 /opt/cpanel/ea-php70/root/usr/bin/phpize && ./configure --enable-gearman --with-php-config=/opt/cpanel/ea-php70/root/usr/bin/php-config && mak
6. If the gearman.so file has now been added to the modules folder you might have to do that manually:
1 cp modules/gearman.so /opt/cpanel/ea-php70/root/usr/lib64/php/modules/
7. Then we need to make PHP aware of the new extension by adding the following line to the correct php.ini file:
1 echo "extension=gearman.so" > /opt/cpanel/ea-php70/root/etc/php.d/40-gearman.ini
8. You might also want to install and start the gearmand service by running:
123 yum install gearmandservice gearmand startchkconfig gearmand on
9. To test if it is all working as expected run:
1 php --info | grep gearman
This is pretty much it.