gpt4 book ai didi

php - Gearman 在 php 示例中抛出 GEARMAN_COULD_NOT_CONNECT

转载 作者:可可西里 更新时间:2023-11-01 01:04:20 25 4
gpt4 key购买 nike

我在我的服务器上安装了 gearmand 1.1.5,并在启动服务器后尝试了安装提供的示例。它们工作得非常正确(echo 示例有效,反向不按预期工作,但没有给出任何错误)。

然后我使用 pecl 安装了 php 包装器。该版本是最后一个稳定版本 (1.1.1)。显然我将扩展名添加到 php.ini,我的 php --info|grep gearman 输出是:

gearman
gearman support => enabled
libgearman version => 1.1.5
PWD => /root/gearman-1.1.1/examples
OLDPWD => /root/gearman-1.1.1
_SERVER["PWD"] => /root/gearman-1.1.1/examples
_SERVER["OLDPWD"] => /root/gearman-1.1.1

然后我尝试了pecl包中的echo例子,worker正确启动:

[~/gearman-1.1.1/examples]# php reverse_worker.php 
Starting
Waiting for job...

相反,客户端给我以下错误:

[~/gearman-1.1.1/examples]# php reverse_client.php 
Starting
Sending job
PHP Warning: GearmanClient::do(): send_packet(GEARMAN_COULD_NOT_CONNECT) Failed to send server-options packet -> libgearman/connection.cc:430 in /root/gearman-1.1.1/examples/reverse_client.php on line 26
PHP Stack trace:
PHP 1. {main}() /root/gearman-1.1.1/examples/reverse_client.php:0
PHP 2. GearmanClient->do() /root/gearman-1.1.1/examples/reverse_client.php:26

Warning: GearmanClient::do(): send_packet(GEARMAN_COULD_NOT_CONNECT) Failed to send server-options packet -> libgearman/connection.cc:430 in /root/gearman-1.1.1/examples/reverse_client.php on line 26

Call Stack:
0.0001 228408 1. {main}() /root/gearman-1.1.1/examples/reverse_client.php:0
0.0003 229552 2. GearmanClient->do() /root/gearman-1.1.1/examples/reverse_client.php:26

RET: 26

在 gearman 守护进程的日志中没有此 php 测试事件的迹象,但它记录了我之前尝试过的所有示例。

如何解决这个错误?谢谢。

最佳答案

您应该始终使用 addServer("127.0.0.1", 4730),而不是 addServer(),不管 php 文档怎么说。

关于php - Gearman 在 php 示例中抛出 GEARMAN_COULD_NOT_CONNECT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14749576/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com