php curl 设置ssl版本 [英] Php curl set ssl version
问题描述
因为 3 天我无法连接到 paypal 沙盒.我发现他们可能禁用了对 SSLv3 的支持.所以我尝试通过设置来更改我的 curl 请求中的 SSL 版本:
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
知道为什么脚本仍在使用 SSLv3 吗?
Any idea why the script is still using SSLv3 ?
我正在使用 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-Negotiate IDN IPv6 Largefile 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屋!