How to Enable fsockopen() | HostGator Support
  1. Knowledge Base
  2. >
  3. Results
  4. >
  5. How to Enable fsockopen()

How to Enable fsockopen()

The fsockopen() php command is supported on all of our shared and reseller servers, along with most of our VPS and Dedicated servers too. The purpose of this command is to open an outbound connection via a specific port to an external server. A common issue with using this command is the firewall on your server may not be configured to allow the connection that you are trying to make, please see below for explanations if you are getting errors on your site.

Common errors:

  • Warning: fsockopen() [function.fsockopen]: unable to connect to (Connection refused) in /home/cpuser/public_html/fsock.php on line 2
    Connection refused (111)
This error normally means that the connection is being blocked either on your server's side (outbound) or on the receiving server's side (inbound). If you are getting this error please contact us via phone or Live Chat. We will be able to determine if the error is being generated by your server or on the remote server. Please see our article on Opening New Ports.
  • Warning: fsockopen() [function.fsockopen]: unable to connect to (Connection timed out) in /home/cpuser/public_html/fsock.php on line 2
    Connection timed out (110)
This error means that the connection timed out while it was being made. This can be cause by several reasons, however normally it means the remote server is not responding. An easy way to check this is by going to the URL in your browser to see if it works directly, such as If it loads there could be other connection issues, please contact our support and we will be glad to look into it further for you.