How to install gearman in a plesk php environment in centos.

gearman

Installing gearman in a plesk/pecl environment is easy.

Install gearman

# yum install gearmand

Install some libraries

Some libraries are required for building the pecl extension for gearman.

[root@h01pl 5.4]# yum install libgearman-devel plesk-php54-devel gcc-c++

Find the path to your php version

In my case (php 5.4) it isĀ /opt/plesk/php/5.4/

[root@h01pl bin]# pwd
/opt/plesk/php/5.4/bin

Build the gearman pecl extension

[root@h01pl bin]# ./pecl install gearman
...
Installing '/opt/plesk/php/5.4/lib64/php/modules/gearman.so'
install ok: channel://pecl.php.net/gearman-1.1.2
configuration option "php_ini" is not set to php.ini location
You should add "extension=gearman.so" to php.ini

Enabling the gearman extension in php.ini

[root@h01pl bin]# cd ../etc/php.d
[root@h01pl php.d]# echo 'extension=gearman.so' > 100-gearman.ini

Verify that gearman is installed correctly

[root@h01pl php.d]# cd ../../bin
[root@h01pl bin]# ./php -ini | grep gearman
/opt/plesk/php/5.4/etc/php.d/100-gearman.ini,
gearman
gearman support => enabled
libgearman version > 1.1.8

Start the gearmand service

[root@h01pl bin]# service gearmand start

Restart the http server

[root@h01pl bin]# service httpd restart

That’s it! You’re done.