【发布时间】:2014-04-25 07:14:50
【问题描述】:
我正在尝试从 php shell_exec 运行 gearman 客户端,但它总是抛出以下错误 GearmanClient::do(): send_packet(GEARMAN_COULD_NOT_CONNECT) Failed to send server-options packet -> libgearman/connection.cc:485 in /var/ www/html/client.php
但如果我从终端运行它,那么它可以工作,但不能从 php shell_exec 运行。即使我在 addServer 方法中传递了服务器名称和端口
我在 centos 6.2 上运行。
客户端.php
$client= new GearmanClient();
$client->addServer('127.0.0.1',4730);
print $client->do("reverse","Testing");
worker.php
$worker= new GearmanWorker();
$worker->addServer("127.0.0.1",4730);
$worker->addFunction("reverse", "my_reverse_function");
function my_reverse_function($job)
{
return strrev($job->workload());
}
【问题讨论】:
标签: php centos shell-exec gearman