PHPMailer 5.2 OpenSSL错误消息:错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败 [英] PHPMailer 5.2 OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

查看:237
本文介绍了PHPMailer 5.2 OpenSSL错误消息:错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PHP 5.6服务器上的PHPMailer遇到此错误.

警告:stream_socket_enable_crypto():SSL操作失败,代码为1.OpenSSL错误消息:error:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书在第344行的class.smtp.php中验证失败

有趣的是,我正在尝试通过本地SMTP服务器@ localhost发送电子邮件,并且我没有使用SSL或TLS-端口25是纯SMTP.

$mail->SMTPSecure=''
$mail->SMTPPort //not set

服务器已为网站域安装了有效的SSL证书.

我已经阅读了GitHub上有关PHP 5.6证书验证失败的文档,并且似乎无法解决这种情况.

我添加了以下代码,但仍然收到错误:

$mail->SMTPOptions = array(
    'ssl' => array(
        'verify_peer' => false,
        'verify_peer_name' => false,
        'allow_self_signed' => true
    )
);

我想主要的问题是,它抱怨什么SSL证书,或者缺少它?

解决方案

PHPMailer的github页面提及这种类型的错误:

故障排除文档中对此进行了介绍. PHP 5.6默认情况下会验证SSL证书,如果您的证书不匹配,它将因该错误而失败.正确的解决方案是修复您的SSL配置-这不是PHP的错!

我发现您遇到了麻烦,因为不推荐使PHPMailer设置不安全. /疑难解答" rel ="nofollow noreferrer">文档疑难解答.您是否注意到需要PHPMailer 5.2.10?

为此的正确解决方法是用一个好的证书替换无效,配置错误或自签名的证书.失败的话,您可以通过PHPMailer 5.2.10中引入的SMTPOptions属性允许不安全的连接(可以通过将SMTP类的子类移植到较早的版本中来实现此目的),尽管不建议这样做

对于启用调试输出:

$mail->SMTPDebug = 4;

如果您查看调试输出,则可以收集更多有用的信息.

这也不关您的网站的证书,而是关于SMTP邮件服务器终结点托管的证书(如果有).

I'm getting this error with PHPMailer on a PHP 5.6 server.

Warning: 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 class.smtp.php on line 344

The interesting thing is I'm trying to send email through the local SMTP server @ localhost, and I'm not using SSL or TLS - it's plain SMTP on port 25.

$mail->SMTPSecure=''
$mail->SMTPPort //not set

The server has a valid SSL Certificate installed for the website domain.

I've read the documentation on GitHub about PHP 5.6 certificate verification failure and it doesn't seem to address this scenario.

I've added this code, but still receive the error:

$mail->SMTPOptions = array(
    'ssl' => array(
        'verify_peer' => false,
        'verify_peer_name' => false,
        'allow_self_signed' => true
    )
);

I guess the main question is, what SSL certificate, or lack thereof is it complaining about?

解决方案

PHPMailer's github page mentions this type of error:

This is covered in the troubleshooting docs. PHP 5.6 verifies SSL certificates by default, and if your cert doesn't match, it will fail with this error. The correct solution is to fix your SSL config - it's not PHP's fault!

I see that you've gone through the trouble of making the PHPMailer settings insecure as is not recommended in the troubleshooting docs. Did you notice that requires PHPMailer 5.2.10?

The correct fix for this is to replace the invalid, misconfigured or self-signed certificate with a good one. Failing that, you can allow insecure connections via the SMTPOptions property introduced in PHPMailer 5.2.10 (it's possible to do this by subclassing the SMTP class in earlier versions), though this is not recommended

There's also suggestions for enabling debug output:

$mail->SMTPDebug = 4;

If you look at the debug output, you may glean more helpful info.

EDIT: this also is not about your website's cert, it's about the cert (if any) being hosted by your SMTP mail server endpoint.

这篇关于PHPMailer 5.2 OpenSSL错误消息:错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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