如何修复stream_socket_enable_crypto():ssl:握手时机
我们面临着将Azure应用程序上的Laravel应用程序连接到端口6380上的Azure Redis Cache实例的问题。我们在下面遇到错误。
ErrorException in StreamConnection.php line 246:
stream_socket_enable_crypto(): SSL: Handshake timed out
in StreamConnection.php line 246
at HandleExceptions->handleError('2', 'stream_socket_enable_crypto(): SSL: Handshake timed out', '/var/www/vendor/predis/predis/src/Connection/StreamConnection.php', '246', array('parameters' => object(Parameters), 'resource' => resource, 'metadata' => array('timed_out' => false, 'blocked' => true, 'eof' => false, 'stream_type' => 'tcp_socket/ssl', 'mode' => 'r+', 'unread_bytes' => '0', 'seekable' => false), 'options' => array('crypto_type' => '9')))
at stream_socket_enable_crypto(resource, true, '9') in StreamConnection.php line 246
数据库配置文件中的REDIS块看起来像这样:
'redis' => [
'client' => 'predis',
'cluster' => false,
'default' => [
'scheme' => 'tls',
'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
'read_write_timeout' => 0,
// 'ssl' => [
// 'verify_peer' => false,
// 'verify_peer_name' => false,
// 'allow_self_signed' => true
// ]
'context' => [
// 'auth' => ['username', 'secret'],
'stream' => [
'verify_peer' => true,
'verify_peer_name' => false,
'allow_self_signed' => true
],
],
],
'options' => [
'parameters' => ['password' => env('REDIS_PASSWORD', null)],
],
],
我期待有关如何解决此问题的指示/提示。提前致谢。
We are facing an issue with connecting a Laravel app on Azure App Service to an Azure Redis Cache instance on port 6380. We keep getting the error below.
ErrorException in StreamConnection.php line 246:
stream_socket_enable_crypto(): SSL: Handshake timed out
in StreamConnection.php line 246
at HandleExceptions->handleError('2', 'stream_socket_enable_crypto(): SSL: Handshake timed out', '/var/www/vendor/predis/predis/src/Connection/StreamConnection.php', '246', array('parameters' => object(Parameters), 'resource' => resource, 'metadata' => array('timed_out' => false, 'blocked' => true, 'eof' => false, 'stream_type' => 'tcp_socket/ssl', 'mode' => 'r+', 'unread_bytes' => '0', 'seekable' => false), 'options' => array('crypto_type' => '9')))
at stream_socket_enable_crypto(resource, true, '9') in StreamConnection.php line 246
The Redis block of code in the database config file looks like this:
'redis' => [
'client' => 'predis',
'cluster' => false,
'default' => [
'scheme' => 'tls',
'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
'read_write_timeout' => 0,
// 'ssl' => [
// 'verify_peer' => false,
// 'verify_peer_name' => false,
// 'allow_self_signed' => true
// ]
'context' => [
// 'auth' => ['username', 'secret'],
'stream' => [
'verify_peer' => true,
'verify_peer_name' => false,
'allow_self_signed' => true
],
],
],
'options' => [
'parameters' => ['password' => env('REDIS_PASSWORD', null)],
],
],
I am looking forward to pointers/tips on how to solve this issue. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此问题是由于方案类型的“ TLS”而发生的。
只需删除方案类型“ TLS”,它就会开始工作。
注意:此解决方案仅适用于本地设置。禁用SSL验证具有安全含义。在不验证SSL/HTTPS连接的真实性的情况下,任何恶意攻击者都可以模仿可信赖的终点,您将容易受到中间攻击的攻击。
This issue occurs due to scheme type 'tls'.
Just remove scheme type 'tls' it will start working.
Note: This solution is for local setup only. Disabling SSL verification has security implications. Without verifying the authenticity of SSL/HTTPS connections, any malicious attacker can impersonate a trusted endpoint, and you'll be vulnerable to a Man-in-the-Middle Attack.