PHP SphinxClient不能获得长时间执行查询的结果


PHP SphinxClient can't get long time execution queries results

我试图获得一些长时间执行查询的结果。每个查询都有相同的结构:

    @CODE (ZZZZZZ|YYYYY...) @FIELD2 YES

每个查询在70-100秒内成功完成(我使用searchd --console来检查它)。但是PHP代码会在60秒后停止等待响应并抛出一个错误

  received zero-sized searchd response 

看起来连接断开了?我使用的是普通的SphinxClient。调用sphinx搜索的PHP代码如下所示:

$this->client->SetServer($this->host, $this->port);
$this->client->SetArrayResult(true);
$this->client->SetWeights(array(100, 1));
$this->client->SetMatchMode($this->mode);
$this->client->SetMaxQueryTime(5000000);
$this->client->SetLimits($this->offset, $this->limit, ($this->limit > 1000) ? $this->limit : 1000);
$this->result = $this->client->Query($this->query, $this->index);

PHP配置

max_execution_time = 120
max_input_time = 120

是否可以设置一些系统设置-这样脚本将能够等待更长的响应时间?我用的是Debian GNU/Linux 5.0.3 Lenny

是否尝试设置setConnectionTimeout?

http://sphinxsearch.com/docs/current.html api-func-setconnecttimeout


虽然设置stream_set_timeout可能更好http://www.php.net/manual/en/function.stream-set-timeout.php将不得不热线sphinxapi.php添加一个调用它。