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

走远了吗. 提交于 2019-12-22 18:39:12

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/5498497/error-with-fsockopen-and-ssl-failed-to-enable-crypto

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!