PHP 警告:stream_socket_client():无法启用加密?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7532129/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 02:53:36  来源:igfitidea点击:

PHP Warning: stream_socket_client(): Failed to enable crypto?

php

提问by Dail

I'm using swiftMailer to send email using SMTP directly.

我正在使用 swiftMailer 直接使用 SMTP 发送电子邮件。

I get this strange error:

我收到这个奇怪的错误:

2011/09/23 17:59:01 [error] 489#0: *1032 FastCGI sent in stderr: "PHP Warning:  stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:
error:140770FC:SSL routines:func(119):reason(252) in /home/nginx/websites/example.com/www/inc/lib/swift-mailer/lib/classes/Swift/Transport/StreamBuffer.php on line 271
PHP Warning:  stream_socket_client(): Failed to enable crypto in /home/nginx/websites/example.com/www/inc/lib/swift-mailer/lib/classes/Swift/Transport/StreamBuffer.php on line 271
PHP Warning:  stream_socket_client(): unable to connect to ssl://mail.xxxxx.net:587 (Unknown error) in /home/nginx/websites/example.com/www/inc/lib/swift-mailer/lib/classes/Swift/Transport/StreamBuffer.php on line 271
PHP Fatal error:  Uncaught exception 'Swift_TransportException' with message 'Connection could not be established with host mail.xxxxxxxx.net [ #0]' in /home/nginx/websites/example.com/www/inc/lib/swift-mailer/lib/classes/Swift/Transport/StreamBuffer.php:273
Stack trace:
#0 /home/nginx/websites/example.com/www/inc/lib/swift-mailer/lib/classes/Swift/Transport/StreamBuffer.php(66): Swift_Transport_StreamBuffer->_establishSocketConnection()
#1 /home/nginx/websites/example.com/www/inc/lib/swift-mailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(116): Swift_Transport_StreamBuffer->initialize(Array)
#2 /home/nginx/websites/example.com/www/inc/lib/swift-mailer/lib/classes/Swift/Mailer.php(79): Swift_Transport_AbstractSmtpTransport->start()
#3 /home/nginx/websites/example.com/www/email.php(23): Swift_Mailer->send(Object(Swift_Message))
#4 {main}
  thrown in /home/nginx/websites/example.com/www/inc/lib/swift-mailer/lib/classes/Swift/Transport/StreamBuffer.php on line 273" while reading response header from upstream, client: xx.xx.xx.xxx, server: example.com, request: "GET /email.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.example.com"

What does it mean? Thanks

这是什么意思?谢谢

回答by woody121

The "failure to enable crypto" means that it was unable to secure the connection - check to be sure that you are successfully passing a certificate, and that your passphrase is set correctly.

“无法启用加密”意味着它无法保护连接 - 检查以确保您成功通过了证书,并且您的密码设置正确。

回答by stackOverFlew

In my case, the issue was with my mac (OSX Sierra). I uploaded php and cert to my server, ran it, and the notification was delivered.

就我而言,问题出在我的 mac (OSX Sierra) 上。我将 php 和 cert 上传到我的服务器,运行它,并发送了通知。

Duplicate: APNS + PHP "stream_socket_client(): Failed to enable crypto"

重复:APNS + PHP“stream_socket_client():无法启用加密”