php - 如何修复stream_socket_enable_crypto() : SSL operation failed with code 1

标签 php laravel amazon-ec2 ssl-certificate apache2.4

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' );
        } );

}
?>

我读了一些关于此的文章,他们说有些事情我们应该做一些更改,他们放置了该代码,但我不知道在哪里插入它。

正在阅读此内容:https://www.mimar.rs/en/sysadmin/2015/php-5-6-x-ssltls-peer-certificates-and-hostnames-verified-by-default/

以及 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/

相关文章:

php - 由于卖家的网站,PayPal 无法处理此交易

php - 拉维尔 4 : how to write the correct nested controller for nested resource?

php - laravel 5.7.15 419 抱歉,您的 session 已过期。请刷新并重试

amazon-web-services - 我可以通过 AutoScaling 在安静时段将实例计数减少到零吗?

go program out of memory ec2资源太小?

为 windows 编译的带有 readline 支持的 php

php 使用 exec() 返回 127

Laravel 结合了 Passport 身份验证和普通身份验证

amazon-ec2 - Tensorflow 安装在 AWS ec2 实例上终止

php - 伪随机字符串