我在 Centos 中安装 sphinx,一切都是正确的
[root@li561-40 ~]# /usr/local/sphinx/bin/search crusher
Sphinx 2.0.6-release (r3473)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file '/usr/local/sphinx/etc/sphinx.conf'...
index 'test1': query 'crusher ': returned 1 matches of 1 total in 0.009 sec
displaying matches:
1. document=2, weight=2500, id_attr=2, date_added=Thu Jan 1 00:00:00 1970
ID=2
crawl_date=0000-00-00 00:00:00
host=(NULL)
url=(NULL)
page_title=crusher for sale
page_content=this is content, stone crusher machine for sale
parent=0
status=publish
type=page
mime_type=
words:
1. 'crusher': 1 documents, 2 hits
但是,当我使用 php api 时,它说连接到 127.0.0.1:9845 失败(errno=0,msg=)
require ( "sphinxapi.php" );
$s = new SphinxClient();
$s->SetServer('localhost',9312);
$result = $s->Query('crusher');
echo $s->getLastError();
[root@li561-40 ~]# netstat -anl | grep 9312
tcp 0 0 0.0.0.0:9312 0.0.0.0:* LISTEN
请告诉我,我该怎么办?