Home >Backend Development >PHP Tutorial >php调用sphinx提示failed to send client protocol version
网上查说是端口和配置文件不一致引起的,我查了下是一致的,我的coreseek /usr/local/coreseek/etc/csft.conf
然后服务器查看 netstat -tunlp | grep searchd显示的也是 9312端口
我在服务器上测试也是正常的
php.ini配置中是这个
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/"
extension=sphinx.so
php代码如下:
$s = new SphinxClient();
$s->setServer("127.0.0.1", 9312);
$s->setMatchMode(SPH_MATCH_ANY);
$s->setMaxQueryTime(3);
$result = $s->query("测试");
var_dump($s);
var_dump($result);
提示:
object(SphinxClient)#1 (2) { ["error"]=> string(38) "failed to send client protocol version" ["warning"]=> string(0) "" } bool(false)
请问到底是哪里错啦
ifconfig 查看实际ip地址
$s->setServer("127.0.0.1", 9312);