简体   繁体   中英

Php connection to Sphinx refused

I have installed Sphinx on my server and everything seems to working, except that when I run the test.php from web browser, I am getting this error: Query failed: connection to localhost:9312 failed (errno=111, msg=Connection refused).

I have searched online, including stack overflow, almost all suggestions were make sure the searchd service is running, and it's listening on the right port. I can say yes to both questions because if run the same test program directly in command line, everything works. I understand that the hosting provider may not have opened the port, but the port should be listening with the server, right? The fact that it works under command line should confirm that the service is listening on that port and the php program is able to get through to it. So I don't understand why the same program run from the web browser rejects the connection.

I have also enabled fsockopen in php.ini.

Any suggestion to help understand why the connection is rejected or even better how to solve it is very welcome!

Thanks

You can try this:

  • check your sphinx.conf and make sure that 9312 is your spinx's port (my default port was 3312)
  • change localhost to 127.0.0.1

If this doesn't work for you check if port is open, you can do it with nmap

sudo apt-get install nmap
nmap 127.0.0.1 -p 9312

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM