开发者

Query failed: connection to localhost:3306 failed in sphinx

I'm trying to use the sphinx api to grab some data from a mysql db, but I keep getting this error when I load it on my browser.

开发者_C百科

Query failed: connection to localhost:3306 failed (errno=4, msg=).

I had no luck when I tried changing the port number to 3312, and a few others..

I was actually able to get results for queries through linux command, but the error occurs when I try it (using the sphinxapi.php file) on my browser

code:

include('sphinxapi.php');

$cl = new SphinxClient();
$cl->SetServer("localhost", 3306);

$cl->SetMatchMode( SPH_MATCH_ANY  );
$result = $cl->Query("email");


if ( $result === false ){ 
      echo "Query failed: " . $cl->GetLastError() . ".\n";
}
else{
    print_r($result);
}

I'm using sphinx 0.9.8


Thanks guys, I actually figured it out. I used my server ip instead of "localhost".


Make sure your sphinx search daemon is running and listening on port 3306

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜