I have been using Shared hosting to host my website. I want to deploy a PHP WebSocket application built using Ratchet PHP. So I want it to listen on port 9000.

When I ran command php server.php in my SSH access it shows server is started and listening on domain.com:9000. But in my chat application, It takes some time and then says:

Firefox can’t establish a connection to the server at ws://domain.com:9000/

Also, I have checked telnet domain.com 9000 which results in

Could not open connection to the host, on port 9000: Connect failed.

I contacted the support about it, they says

Your Port 9000 is opened for OutBound Connections.

How can I check whether my port is opened? and also If opened why It doesn't listens to the connections made by a web browser as client to server?


Your Port 9000 is opened for OutBound Connections.

But that's not what you're trying to do. You're trying to make an inbound connection to the server, not an outbound connection from the server.

How can I check whether my port is opened?

Contact the hosting provider, and be clear that you want to set up a listener on port 9000 on your shared-hosting account, rather than making outbound connections.

On a shared server, the hosting provider might not allow any inbound connections at all, or they might require you to use a specific range of ports.

(Meanwhile, on a private/dedicated server, the only restrictions are those that you've set yourself on the server's firewall, so you would check by looking at the firewall rules – iptables, ufw, firewalld, and such.)

|improve this answer|||||

If you have ssh access, in a linux system, you can query your firewall rules using iptables:

sudo iptables -S | grep ACCEPT

If the firewall rule's was modified using the firewall-cmd, you can query the rules using the following command:

sudo firewall-cmd --list-all

For a complete 'map' of the firewall (useful if you need to understand how the various chain are configured), you can run the following command:

sudo iptables -L
|improve this answer|||||
  • iptables v1.4.21: can't initialize iptables table `filter': Permission denied (you must be root) Perhaps iptables or your kernel needs to be upgraded. – Āchahms Sep 18 '19 at 9:03
  • These command have to be sent using the super user. Login as root or place 'sudo' before the command in order to run it as superuser – alessiosavi Sep 18 '19 at 9:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.