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.

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



$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";

I'm using sphinx 0.9.8


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

Need Your Help

Use gradle to run the touch command on a file

gradle touch

I have a build.gradle file that runs a series of tasks before building my android APK. I looked through the documentation but I didn't find an answer so I'll ask here. Is it possible - and if it is...

Computing XML document similarity based on tags

xml xslt pattern-matching string-matching similarity

As a method for computing similarity between XML documents (usually several but in this case, two ones), tag-based similarity computation has several applications. Now, how to implement such a method

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.