phpsslopensslnominetepp

Error with fsockopen() and SSL, 'Failed to enable crypto'


I am trying to connect to the Nominet EPP test bed, but I am receiving a 'Failed to enable crypto' which seems to be a rare error with no documented solution or cause.

With the line:

$socket = fsockopen('ssl://testbed-epp.nominet.org.uk', 700, $errno, $errst, 10);

The exact error I am getting is:

Warning: fsockopen() [function.fsockopen]: Failed to enable crypto in /path/classes/nominet_epp.class.php on line 53

Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://testbed-epp.nominet.org.uk:700 (Unknown error) in /path/classes/nominet_epp.class.php on line 53

As far as I can tell OpenSSL is installed with PHP fine, as per this in our phpinfo():

OpenSSL support     enabled
OpenSSL Version     OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008

The Nominet docs briefly mention "In order to verify the identity of the secure server you will need the Verisign Class 3 Public Primary Certification Authority' root certificate available free from www.verisign.com (the certificate is also distributed with most web browsers). - This could possibly be the issue?

Update As requested, I have var_dump'd the error values as well as $socket itself, they are all false/0. The fsockopen PHP docs states "If the value returned in errno is 0 and the function returned FALSE, it is an indication that the error occurred before the connect() call. This is most likely due to a problem initializing the socket."

Any help would be greatly appreciated.


Solution

  • I had exactly the same issue and it was down to the Nominet Firewall not being updated with the correct IP address. When you set this up in the Nominet control panel you need to wait an hour for their firewalls to fully update - once this is done the connection works fine.