stream_socket_enable_crypto(): SSL operation failed with code 1.
OpenSSL Error messages: error:14090086:SSL
routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
我使用 Laravel 4.2、PHP 5.6、Apache 2.4
我在 Amazon ec2 Linux 中安装了 GoDaddy SSL。
当我使用 https 访问网站时,SSL 工作正常。
当我调用我的函数时发生错误:
<?php
public function sendEmail()
{
\Mail::send ( 'emails.code.code', $data, function ($sendemail) use($email) {
$sendemail->from ( 'info@me.com', 'Me Team' );
$sendemail->to ( $email, '' )->subject ( 'Activate your account' );
} );
}
?>
我读了一些关于此的文章,他们说有些事情我们应该做一些更改,他们放置了该代码,但我不知道在哪里插入它。
以及 php http://php.net/manual/en/migration56.openssl.php 的文档这很难理解。
所以我的问题是如何解决这个问题?
最佳答案
Editor's note: disabling SSL verification has security implications. Without verification of the authenticity of SSL/HTTPS connections, a malicious attacker can impersonate a trusted endpoint such as Gmail, and you'll be vulnerable to a Man-in-the-Middle Attack.
Be sure you fully understand the security issues before using this as a solution.
您可以在/config/mail.php 中添加以下代码(已在 laravel 5.1、5.2、5.4 上测试并运行)
'stream' => [
'ssl' => [
'allow_self_signed' => true,
'verify_peer' => false,
'verify_peer_name' => false,
],
],
关于php - 如何修复stream_socket_enable_crypto() : SSL operation failed with code 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30556773/