无法运行Gearman worker语言 - 未定义符号:ZVAL_NEW_ARR



我已经在我的系统上安装了Gearman,当我运行php --info | grep gearman时,我得到

php --info | grep gearman
gearman
gearman support => enabled
libgearman version => 1.1.19.1+ds

我还添加了php.ini -extension=/usr/lib/php/20210902/gearman.so

lsof -i tcp:4730显示正在运行

COMMAND     PID USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
gearmand 297767 root   10u  IPv4 1211167      0t0  TCP localhost:4730 (LISTEN)

当我尝试运行一个worker时,我得到:

php: symbol lookup error: /usr/lib/php/20210902/gearman.so: undefined symbol: ZVAL_NEW_ARR

Workers/client是来自Gearman页面的基本元素。工人:

<?php
$worker= new GearmanWorker();
$worker->addServer();
$worker->addFunction("reverse", "my_reverse_function");
while ($worker->work());
function my_reverse_function($job)
{
return strrev($job->workload());
}
?>

客户

<?php
$client= new GearmanClient();
$client->addServer();
print $client->do("reverse", "Hello World!");
?>

有人能帮忙吗?

我遇到了同样的问题,这是因为最新版本的Gearman不支持php8.1 (https://github.com/php/pecl-networking-gearman/commit/7da13e4babc17067b2b45d6b37041c3c8ed91637)。

我使用了如何在ubuntu 18.04上运行的php7中安装gearman扩展的构建说明,但是从他们的git仓库克隆了最新的提交,而不是使用可下载的包,这对我来说很有效。

所以对于我运行在centos7和php8.1从remi的repo我有…

git clone https://github.com/php/pecl-networking-gearman.git
cd pecl-networking-gearman
/opt/remi/php81/root/bin/phpize
./configure --with-php-config=/opt/remi/php81/root/bin/php-config
make
make install
echo "extension=gearman.so" | tee /etc/opt/remi/php81/php.d/20-gearman.ini

最新更新