views:

142

answers:

0

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?