A step by step guide on how to install gearman for PHP 7.x on a cPanel EA 4 server.
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:
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:
/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:
yum install libgearman yum install libgearman-devel
1. Create a temporary directory that would hold our source files:
mkdir gearman-70 cd /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:
git clone https://github.com/wcgallego/pecl-gearman.git
4. The access the folder containing the source files:
5. Then use the following command here:
/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:
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:
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:
yum install gearmand service gearmand start chkconfig gearmand on
9. To test if it is all working as expected run:
php --info | grep gearman
This is pretty much it.