警告:stream_socket_enable_crypto():SSL操作失败,代码为1 [英] Warning: stream_socket_enable_crypto(): SSL operation failed with code 1

查看:2281
本文介绍了警告:stream_socket_enable_crypto():SSL操作失败,代码为1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对CSCart有问题,它无法通过Google帐户发送邮件. 为了检查服务器配置或CSCart脚本中是否存在问题,我安装了干净的库PHPMailer,并尝试使用示例脚本发送测试消息. 结果是相同的:

I have a problem with CSCart, it fails sending mail via google account. To check if there is a problem in server config or in CSCart's scripts I installed clean library PHPMailer and tried to send test message using example script. Result is the same:

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 [script path]/class.smtp.php on line 338    

从控制台的OpenSSL连接工作正常.

OpenSSL connection from console works good.

FreeBSD 10.0,Apache24,php5.6.

FreeBSD 10.0, Apache24, php5.6.

我在google中找不到任何信息,现在我什至不知道要在哪个配置文件中搜索问题根.

I could not find any information in google and for now I even do not know in which config file to search the issue root.

推荐答案

这是由于PHP 5.6中采用了新的默认验证策略.尚未在php.ini中设置;这是您提供的用于打开包装器或流上下文的选项.在此处(尤其是verify_peer)中查看. PHPMailer允许您在smtpConnect()方法期间设置这些参数,但是没有选项可以将选项传递给smtpSend()方法,因此您将需要对PHPMailer进行子类化.

This is due to the new verify-by-default policy in PHP 5.6. It's not set in php.ini; it's an option you an provide to fopen wrappers or stream contexts. Have a look at the options here, especially verify_peer. PHPMailer allows you to set these params during the smtpConnect() method, but there is no option to pass options into the smtpSend() method, so you will need to subclass PHPMailer to get at that.

您可能会找到更简单的替代方法-

You may find the alternative simpler - don't try to use a self-signed or unverifiable certificate.

这篇关于警告:stream_socket_enable_crypto():SSL操作失败,代码为1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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