Stripe-PHP错误-Stripe不再支持使用TLS 1.0发出的API请求 [英] Stripe - PHP error - Stripe no longer supports API requests made with TLS 1.0

查看:172
本文介绍了Stripe-PHP错误-Stripe不再支持使用TLS 1.0发出的API请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在没有HTTPS页面的情况下运行条带测试?我的本地主机上似乎出现以下错误.有办法纠正吗?

Is it possible to run stripe tests without an HTTPS page? I seem to be getting the following error on my localhost. Is there a way to correct it?

这是在提交付款信息之后发生的.

This happens after submitting the payment information.

致命错误:未捕获的异常'Stripe \ Error \ Authentication'与 message'Stripe不再支持使用TLS 1.0发出的API请求. 请使用TLS 1.2或更高版本启动HTTPS连接.你可以学习 有关详细信息,请访问 https://stripe.com/blog/upgrading-tls ."在 /Applications/MAMP/htdocs/composer/vendor/stripe/stripe-php/lib/ApiRequestor.php:110 来自API请求'req_9AwHIpLsRiWhRz'的堆栈跟踪:#0 /Applications/MAMP/htdocs/composer/vendor/stripe/stripe-php/lib/ApiRequestor.php(227): Stripe \ ApiRequestor-> handleApiError('{\ ​​n"error":{\ n ...',401,Array, 阵列)#1 /Applications/MAMP/htdocs/composer/vendor/stripe/stripe-php/lib/ApiRequestor.php(65): Stripe \ ApiRequestor-> _ interpretResponse('{\ ​​n"error":{\ n ...',401, 阵列)#2 /Applications/MAMP/htdocs/composer/vendor/stripe/stripe-php/lib/ApiResource.php(120): Stripe \ ApiRequestor-> request('post','/v1/customers',Array,Array)#3 /Applications/MAMP/htdocs/composer/vendor/stripe/stripe-php/lib/ApiResource.php(160): Stripe \ ApiResource :: _ staticRequest('post','/v1/custom in /Applications/MAMP/htdocs/composer/vendor/stripe/stripe-php/lib/ApiRequestor.php 在第110行

Fatal error: Uncaught exception 'Stripe\Error\Authentication' with message 'Stripe no longer supports API requests made with TLS 1.0. Please initiate HTTPS connections with TLS 1.2 or later. You can learn more about this at https://stripe.com/blog/upgrading-tls.' in /Applications/MAMP/htdocs/composer/vendor/stripe/stripe-php/lib/ApiRequestor.php:110 from API request 'req_9AwHIpLsRiWhRz' Stack trace: #0 /Applications/MAMP/htdocs/composer/vendor/stripe/stripe-php/lib/ApiRequestor.php(227): Stripe\ApiRequestor->handleApiError('{\n "error": {\n...', 401, Array, Array) #1 /Applications/MAMP/htdocs/composer/vendor/stripe/stripe-php/lib/ApiRequestor.php(65): Stripe\ApiRequestor->_interpretResponse('{\n "error": {\n...', 401, Array) #2 /Applications/MAMP/htdocs/composer/vendor/stripe/stripe-php/lib/ApiResource.php(120): Stripe\ApiRequestor->request('post', '/v1/customers', Array, Array) #3 /Applications/MAMP/htdocs/composer/vendor/stripe/stripe-php/lib/ApiResource.php(160): Stripe\ApiResource::_staticRequest('post', '/v1/custom in /Applications/MAMP/htdocs/composer/vendor/stripe/stripe-php/lib/ApiRequestor.php on line 110

推荐答案

此处的问题不是使用HTTPS页面.这是服务器(在本例中为本地计算机)和Stripe之间的TLS通信.几个月前,Stripe发表了一篇博客文章,解释说,出于安全原因,它们将弃用一些被认为不安全的旧协议.您可以在此处了解更多信息:

The issue here is not use of a HTTPS page. It's the TLS communication between your server (local machine in this case) and Stripe. A few months ago, Stripe published a blog post explaining that, for security reasons, they'd be deprecating some old protocols that are considered insecure. You can read more about this here:

https://stripe.com/blog/upgrading-tls

现在,如果遇到此问题,则服务器或计算机默认使用TLS 1.0而不是必需的TLS 1.2.

Right now, if you are hitting this issue your server or machine is defaulting to use TLS 1.0 instead of the required TLS 1.2.

通常,这是由于软件过时或计算机上的配置问题所致.我建议您阅读Stripe的支持文章,其中详细介绍了如何测试代码以及​​升级路径(包括Mac OS和MAMP所特有的一些细节-本质上,您需要使用系统php而不是MAMP捆绑的版本):

Usually this is due to outdated software or a configuration issue on your machine. What I'd recommend is that you look into Stripe's support articles which detail how to test your code, as well as upgrade paths (including a bit of detail specific for Mac OS and MAMP --- essentially you will need to run your application with system php rather than the version bundled with MAMP):

此外,如果您发现系统不支持TLS 1.2,则应升级服务器以正确支持TLS 1.2.这可能需要升级操作系统,curl,openssl和/或语言库.

Moreover, if you find TLS 1.2 is not supported by your system, you should upgrade your server to properly support TLS 1.2. This may require upgrading the operating system, curl, openssl and/or language libraries.

https ://support.stripe.com/questions/how-do-i-upgrade-my-openssl-to-support-tls-1-2

此测试脚本有助于识别PHP安装所使用的库版本: https://gist .github.com/olivierbellone/9f93efe9bd68de33e9b3a3afbd3835cf

This test script can be helpful in identifying library versions used by your PHP install: https://gist.github.com/olivierbellone/9f93efe9bd68de33e9b3a3afbd3835cf

如果您正在使用PHP库的3.x版本,则可以考虑升级到4.x分支.虽然更新系统库是这里最好的解决方案,但是4.x分支允许您传递CURLOPT_SSLVERSION标志,这可能允许某些版本的PHP/curl通过TLS 1.2成功通信.

If you're using a 3.x version of the PHP library, you may consider upgrading to the 4.x branch. While updating your system libraries is the best solution here, the 4.x branch allows you to pass the CURLOPT_SSLVERSION flag, which may allow some versions of PHP/curl to successfully communicate over TLS 1.2.

https://github.com/stripe/stripe- php#ssl--tls-compatibility-issues

这篇关于Stripe-PHP错误-Stripe不再支持使用TLS 1.0发出的API请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆