Skip to content
Home » Web » How to Resolve "Could not open socket" From reCaptcha

How to Resolve "Could not open socket" From reCaptcha

If you met the following error from the browser, it could be a reCaptcha problem.

Could not open socket

It seems a DNS problem, you can take the following steps to resolve:

  1. Make sure the value of RECAPTCHA_VERIFY_SERVER in recaptchalib.php.
  2. ...
    define("RECAPTCHA_VERIFY_SERVER", "www.google.com");
    ...
  3. Get A records of the verify server.
  4. [root@localhost ~]# host www.google.com
    www.google.com has address 173.194.127.82
    www.google.com has address 173.194.127.83
    www.google.com has address 173.194.127.84
    www.google.com has address 173.194.127.80
    www.google.com has address 173.194.127.81
    www.google.com has IPv6 address 2404:6800:4005:c00::68
  5. Add the A records to you local host file.
  6. [root@localhost ~]# vi /etc/hosts
    ...
    173.194.127.82  www.google.com
    173.194.127.83  www.google.com
    173.194.127.84  www.google.com
    173.194.127.80  www.google.com
    173.194.127.81  www.google.com

It should work fine now.

Another way to resolve this is to add reliable name servers like Google public DNS to your network configuration:

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
...
DNS2=8.8.8.8
DNS3=8.8.4.4
...

Don't forget to restart the primary NIC or network service to take effect.

Leave a Reply

Your email address will not be published. Required fields are marked *