开发者

fsockopen issue when opening port to sphinx only in php

I have an issue when connecting php and only php to the sphinx daemon. I have tested the sample sphinx php example test.php and narrowed it down to being a connection problem.

I have the follow piece of code which shows the problem,

<?php
$fp = @fsockopen ( '127.0.0.1', '9312', $errno, $errstr,300 );
if(!$fp) {
  echo "$errstr ($errno)";
}
?>

Whenever it runs from command line or browser I get the following error,

Connection refused (111)

I have verified the following,

  1. searchd is indeed running and on port 9312
  2. searchd can be connected to using telnet
  3. searchd can be connected to using test.py in the sphinx api
  4. php can connect to port 80

It is running on 开发者_开发知识库a Westhost VPS which seems to be the issue since it works fine on my local test machine. I have existing code which was using Python to run searches against the index without any issues so this one has me well and truly stumped.

Some additional info,

PHP 5.2.5 Sphinx 0.9.9-release

Anyone have any ideas how I could diagnose and fix this issue further?


Maybe you could use cmd: netstat -an

To see what ip:port is Sphinx Server running, then use that ip and port in fsocketopen() function

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜