php – localhost和“stream_socket_enable_crypto():SSL操作失败,代码为1”

前端之家收集整理的这篇文章主要介绍了php – localhost和“stream_socket_enable_crypto():SSL操作失败,代码为1”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用gmail发送电子邮件,一切都运行得很好,但突然之间停止了工作.它告诉我这个
ErrorException in StreamBuffer.PHP line 94:

stream_socket_enable_crypto(): SSL operation Failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify Failed

in StreamBuffer.PHP line 94
at HandleExceptions->handleError('2','stream_socket_enable_crypto(): SSL operation Failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify Failed','C:\xampp\htdocs\coparmex\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.PHP','94',array())
at stream_socket_enable_crypto(resource,true,'9') in StreamBuffer.PHP line 94
at Swift_Transport_StreamBuffer->startTLS() in EsmtpTransport.PHP line 313
at Swift_Transport_EsmtpTransport->_doHeloCommand() in AbstractSmtpTransport.PHP line 118
at Swift_Transport_AbstractSmtpTransport->start() in Mailer.PHP line 79
at Swift_Mailer->send(object(Swift_Message),array()) in Mailer.PHP line 385
at Mailer->sendSwiftMessage(object(Swift_Message)) in Mailer.PHP line 171

这只发生在我的localhost中,在web主机上运行正常.我不明白发生了什么:c

这些是我的Gmail设置

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=gmail
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
这是您的SSL证书的错误.您正在尝试使用没有适当证书的SSL连接(加密,安全连接).

那是因为你从localhost连接,这是不安全的,并且被连接阻止.您可以通过将localhost连接更改为基于SSL的连接来避免这种情况.

有关详细信息,请参见this link.

猜你在找的PHP相关文章