duanmi8349 2014-02-09 21:06
浏览 43
已采纳

PHP无法连接到Live Site上的Sphinx

I get the error "Warning: mysqli::mysqli(): (HY000/2005): Unknown MySQL server host '127.0.0.1:9306' (0)". According to the netstat command the port 9306 is open but it can't connect via PHP or the command prompt. The command prompt connects to MySQL on port 9306 instead of connecting to sphinx.

The code that causes this is:

$sphinx = new mysqli('127.0.0.1:9306');

This is on Linux and the Sphinx version is 2.0.4. Other versions including 2.2.1 have been tried.

Can anyone help me get this working?

This is my first question so let me know if I need to change the format of this question.

  • 写回答

1条回答 默认 最新

  • dtot74529 2014-02-09 21:47
    关注

    Re the command-line client, you probably need to explicitally tell it use tcp

    mysql -P 9306 --protocol=tcp
    

    Its counter-intutive, that the mysql client will silentiy ignore the -P param, if it finds a mysql server on the local machine.

    And as for PHP, no idea if what you have should work, but I tend to use

    $sphinx = new mysqli("127.0.0.1", "", "", "", 9306);
    

    which works for me.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 R语言卸载之后无法重装,显示电脑存在下载某些较大二进制文件行为,怎么办
  • ¥15 java 的protected权限 ,问题在注释里