PHP SoapClient::SoapClient 失败:SSL:握手超时且无法启用加密

PHP SoapClient::SoapClient failing with: SSL: Handshake timed and Failed to enable crypto

以下所有内容都在 Amazon EC2运行ning

几个月来我一直在使用 ExactTarget 的 API 发送电子邮件,但它在我的 QA 环境中停止工作了。以下所有代码在我的生产环境中都能正常工作。他们的 SDK 提供了一个名为 ET_Client 的 class,它扩展了内置的 PHP SoapClient。有问题的代码行是对

的调用
parent::__construct($wsdl, array('trace'=>1, 'exceptions'=>0,'connection_timeout'=>120)

这只是对 SoapClient 构造函数的调用。

我在日志文件中遇到的错误如下:

[26-Jul-2017 13:42:52 America/New_York] PHP Warning: SoapClient::SoapClient(): SSL: Handshake timed out in /var/www/vhosts/qa.devepc.com/repo/httpdocs/lib/vendor/exacttarget/fuel-sdk-php/ET_Client.php on line 74 [26-Jul-2017 13:42:52 America/New_York] PHP Warning: SoapClient::SoapClient(): Failed to enable crypto in /var/www/vhosts/qa.devepc.com/repo/httpdocs/lib/vendor/exacttarget/fuel-sdk-php/ET_Client.php on line 74 [26-Jul-2017 13:42:52 America/New_York] PHP Warning: SoapClient::SoapClient(https://webservice.exacttarget.com/ETFrameworkFault.xsd): failed to open stream: operation failed in /var/www/vhosts/qa.devepc.com/repo/httpdocs/lib/vendor/exacttarget/fuel-sdk-php/ET_Client.php on line 74 [26-Jul-2017 13:42:52 America/New_York] PHP Warning: SoapClient::SoapClient(): I/O warning : failed to load external entity "https://webservice.exacttarget.com/ETFrameworkFault.xsd" in /var/www/vhosts/qa.devepc.com/repo/httpdocs/lib/vendor/exacttarget/fuel-sdk-php/ET_Client.php on line 74 [26-Jul-2017 13:42:52 America/New_York] PHP Fatal error: SOAP-ERROR: Parsing Schema: can't import schema from 'https://webservice.exacttarget.com/ETFrameworkFault.xsd' in /var/www/vhosts/qa.devepc.com/repo/httpdocs/lib/vendor/exacttarget/fuel-sdk-php/ET_Client.php on line 74

我还发现,在尝试将 file_get_contents() 与 SSL 资源一起使用时,我遇到了类似的错误。

这个命令:

php -r "var_dump(file_get_contents('https://google.com/'));"

给我以下内容。

[26-Jul-2017 18:06:13 UTC] PHP Warning: file_get_contents(): SSL: Handshake timed out in Command line code on line 1 [26-Jul-2017 18:06:13 UTC] PHP Warning: file_get_contents(): Failed to enable crypto in Command line code on line 1 [26-Jul-2017 18:06:13 UTC] PHP Warning: file_get_contents(https://google.com/): failed to open stream: operation failed in Command line code on line 1

问题可能是由于两个服务器之间的细微版本差异引起的,但是,它一直工作到 2017 年 7 月 13 日,并且自 2 月以来服务器没有更新。另外,我昨天更新了整个服务器,PHP 从 5.6.25 升级到 5.6.30。我的生产服务器是 5.6.22.

我已尝试使用传递给 stream_context_create 的选项操纵 SSL 流来解决问题,但错误仍然存​​在。

当我搜索 "Failed to enable crypto" 和 "SSL: Handshake timed out" 时,我找到了很多将 curl 与流上下文一起使用的结果,但没有找到任何与 SoapClient 相关的结果。此外,我不想编辑 ExactTarget Fuel SDK 中的代码,因为我想让供应商库完好无损。

有没有人运行遇到过肥皂的这个或类似问题,如果有,有解决方案吗?

提前致谢。

php.ini

default_socket_timeout=-1  

可能会导致此错误。尝试将其设置为 -1

以外的值