Php curl设置ssl版本 [英] Php curl set ssl version
问题描述
自3天以后,我无法连接到paypal沙箱。我发现他们可能不支持SSLv3。所以我试图改变SSL版本在我的curl请求通过设置:
Since 3 days I can't connect to the paypal sandbox. I found out that they maybe dissabled the support for SSLv3. So i tried to change the SSL Version in my curl Request by setting :
curl_setopt($curl, CURLOPT_SSLVERSION,1); # 1 = TLSv1
但它仍然会给我相同的错误:
But it still give me the same error :
error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
我使用php 5.5和下面的curl版本(目前问我的主机[托管在1& 1]升级到较新版本)
I am using php 5.5 and the following curl version ( currently asking at my hoster [ managed hosting at 1&1 ] to upgrade to a newer version)
curl 7.21.0(i486-pc-linux-gnu)libcurl / 7.21.0 OpenSSL / 0.9 .8o zlib / 1.2.3.4 libidn / 1.15 libssh2 / 1.2.6
协议:dict文件ftp ftps http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
特性:GSS协商IDN IPv6大文件NTLM SSL libz
curl 7.21.0 (i486-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6 Protocols: dict file ftp ftps http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz
推荐答案
问题是PayPal放弃了对SSLv3,TLS 1.0和TLS 1.1的支持, TLS 1.2,但OpenSSL版本cURL( 0.9.8o
)不支持TLS。
The problem is that PayPal dropped support for SSLv3, TLS 1.0, and TLS 1.1 and now only support TLS 1.2 but the OpenSSL version cURL is built with (0.9.8o
) does not support TLS.
点你可以做的是希望主机可以更新OpenSSL,cURL和PHP到更新的(1.0+)版本的OpenSSL。
At this point all you can do is hope the host can update OpenSSL, cURL, and PHP to a newer (1.0+) version of OpenSSL.
现在,你的cURL客户端不会说PayPal需要的TLS,除了更新OpenSSL之外没有其他方法。
As it stands now, your cURL client doesn't speak TLS which is required by PayPal and there are no ways around it other than updating OpenSSL.
这篇关于Php curl设置ssl版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!