2014-04-25 4 views
2

PHP shell_exec에서 gearman 클라이언트를 실행하려고하는데 GearmanClient :: do() : send_packet (GEARMAN_COULD_NOT_CONNECT) 옵션 패킷 -> libgearman/connection.cc : 485 in /var/www/html/client.phpGearmanClient :: do() : send_packet (GEARMAN_COULD_NOT_CONNECT)가 PHP에서 실패했습니다. shell_exec

하지만 터미널에서 실행하면 작동하지만 php shell_exec에서는 작동하지 않습니다. 심지어 서버 이름과 포트를 addServer 메소드에 전달했습니다.

나는 centos 6.2에서 실행 중입니다.

Client.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()); 
     } 

답변

0

당신의 Gearman을 패키지가 설치되어 있는지 확인합니다. 또는 필요할 경우 수동으로 설치하십시오. 때때로 시스템을 업그레이드하면 패키지가 손실 될 수 있습니다.

두 번째로 나는 변경이 문제를 처리 다른 질문을 읽고 당신을 확인하거나 여기 http://gearman.org/getting-started/

gearmand -vvv 

을 언급 한 바와 같이 디버그 모드에서 실행 한 후이 배경

gearmand -d 

에서 실행 시작 from

$woker->addServer('127.0.0.1',4730); 
,
$worker->addServer('127.0.0.1:4730'); 

$client->addServer('127.0.0.1',4730);

의 동일