3

サーバーにgearmand1.1.5をインストールし、サーバーの起動後にインストールで提供された例を試しました。それらはかなり正しく機能します(エコーの例は機能し、逆は期待どおりに機能しませんが、エラーは発生しません)。

次に、peclを使用してphpラッパーをインストールしました。バージョンは最後の安定版(1.1.1)です。明らかに、php.iniに拡張子を追加し、php --info|grepギアマンの出力は次のとおりです。

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の例を試しましたが、ワーカーは正しく起動します。

[~/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

ギアマンデーモンのログには、このphpテストのアクティビティの兆候はありませんが、私が試した以前のすべての例がログに記録されています。

このエラーを修正するにはどうすればよいですか?ありがとう。

4

2 に答える 2

4

phpのドキュメントに記載されていることにもかかわらず、常にaddServer("127.0.0.1", 4730)ではなくを使用する必要があります。addServer()

于 2013-04-30T02:39:26.900 に答える
0

このようなものを使用した場合

$ client-> addServers( '127.0.0.1'、4730);

また

$ client-> addServers();

それでも機能しなかったので、このようなものを使用します

$ client-> addServers( '127.0.0.1:4730');

PS-ローカルホストIPを使用しましたが、これは実際のホストIPに置き換えることができます。

于 2016-04-18T11:46:02.303 に答える