I have installed Gearman on my system and when I run php --info | grep gearman I've got
php --info | grep gearman
gearman
gearman support => enabled
libgearman version => 1.1.19.1+ds
Also, I have added in php.ini - extension=/usr/lib/php/20210902/gearman.so
lsof -i tcp:4730 shows that it is running
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
gearmand 297767 root 10u IPv4 1211167 0t0 TCP localhost:4730 (LISTEN)
When I try to run a worker I've got:
php: symbol lookup error: /usr/lib/php/20210902/gearman.so: undefined symbol: ZVAL_NEW_ARR
Workers/clients are the basic ones from the Gearman page. Worker:
<?php
$worker= new GearmanWorker();
$worker->addServer();
$worker->addFunction("reverse", "my_reverse_function");
while ($worker->work());
function my_reverse_function($job)
{
return strrev($job->workload());
}
?>
Client
<?php
$client= new GearmanClient();
$client->addServer();
print $client->do("reverse", "Hello World!");
?>
Can anyone help here?
I had the same issue and it was because the latest release of Gearman doesn't support php8.1 (https://github.com/php/pecl-networking-gearman/commit/7da13e4babc17067b2b45d6b37041c3c8ed91637).
I used the build instructions from How to install gearman extension in php7 running on ubuntu 18.04 but cloned the latest commit from their git repo instead of using the downloadable package and that worked for me.
So for me running on centos7 with php8.1 from remi's repo I had...