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
Related
I have set up a raspberry PI 4 with Ubuntu. Apache, PHP, mysql and phpmyadmin are installed and working fine. So when I am trying to connect from another network with my windows device over MySQL Workbench there is an error occuring.
error
Checked: port forwarding on port 80 is open. checked binding ip in mysqld.conf (maybe I made a mistake there) when I try to change the port in this configuration file to 80 and restart "sudo service mysql restart" this error occure "Job for mysql.service failed because the control process exited with error code"
So maybe mysql is not listening to port 80. I have checked sudo lsof -i :80. Only found records from apache listening to port 80.
I am trying for three days now to connect to the database.
Thank you for your help guys!
By default, mysql listens on port 3306, so if you are trying to connect directly to mysql, that could be the issue. Port 80 and 443 are for http/https respectively.
You can't set the port to port 80 because apache needs that port to listen for http requests.
Try setting the port back to 3306 on the mysql host machine and seeing if that works. You may also need to open that port on the host machine as well.
I have installed redis packages on my AWS ubuntu server and everything is working fine from the command line.
I have run the below things from command line and it shows me correct response.
netstat -nlpt | grep 6379
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 23504/redis-server
so my redis server is running correctly on 6379 port also I have added this port on aws security group so firewall is also not blocking.
Also when I check my redis log it also seems to be fine. below is my log.
The server is now ready to accept connections on port 6379
But when I run the below code from my PHP and I get the below error.
$redis = new Redis();
$redis->connect('localhost');
$redis->set('param',999);
echo $redis->get('param');die;
Error I am getting...
The mcook.co.in page isn’t working
mcook.co.in is currently unable to handle this request.
HTTP ERROR 500
I have tried the below solution mentioned in stackoverflow.com but none of are working for me.
Redis - Connect to Remote Server.
EDIT:
I want to telnet into my web server on localhost, and request my php file from command line:
I have:
1) cd'd into the directory I want to serve, namely "/www" (hello.php is here)
2) run a server at directory www: python -m SimpleHTTPServer
3) telnet localhost 80
but "connection is refused". what am I doing wrong?
You're probably trying to connect to a wrong port. Check with netstat -lntp which port is your http server listening on. The process will be listed as python/pid_number.
If you're using Linux then try this:
$ telnet localhost 80
GET /hello.php
I have setup my wercker.yml file with the following step midway:
- script:
name: Serve application
code: php -S localhost:8000 >> /dev/null &
That appears to run, however, in another step when I try cURL to http://localhost:8000 I get the following:
curl: (7) Failed to connect to localhost port 8000: Connection refused
It does it for all ports, not just 8000. Has anyone else managed to get PHP's in built server working in wercker, or open any ports?
Assuming you're using the wercker CLI and trying to set up a development pipeline, you need to use wercker dev with the --publish 8000 argument. This will forward the traffic from your host on port 8000 to the container on port 8000.
Also, if you're using boot2docker, you can't specify localhost, since boot2docker spins up a VM that runs docker. In that case you'll need to use your boot2docker IP, which you can find by running the boot2docker ip command.
I'm using Vagrant box using puphpet, the environment is PHP 5.5 + ubuntu 12.04 + apache + mysql. My Vagrant VM ip: 192.168.11.11, local machine hosts points to 192.168.11.11 reactphp.dev, and it works.
And, I'm using this code: https://github.com/muuknl/phprealtimechat to test websocket.
Then I visit reactphp.dev in my Chrome browser, and I start server script using: php bin/server.php, and after I type in the username I just got the error:
WebSocket connection to 'ws://192.168.11.11:2000/' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT
It works well when I changed the websocket ip to `ws://127.0.0.1:2000/', but why it does not work if I change to my VM's ip address?
It's been a while I haven't used PuPHPet, but when I had troubles connecting through the port (minus port 22), I've had to issue the command sudo ufw disable in the vagrant machine.
If uwf isn't the managing firewall of your vm, try sudo service iptables stop, or sudo iptables -F.
Perhaps they've changed the behavior since then, but it's still good to try.
The SSH tunnel (over the opened port 22) might allow you to access the local port 2000, which is proxified over. The actual port 2000 of the VM might be limited due to firewall.
Try it, and tell me if this works. If not, I'll dig in deeper.