Home >Backend Development >PHP Tutorial >How to Fix \'stream_socket_enable_crypto(): SSL operation failed with code 1\' Error in Laravel 4.2?

How to Fix \'stream_socket_enable_crypto(): SSL operation failed with code 1\' Error in Laravel 4.2?

Linda Hamilton
Linda HamiltonOriginal
2024-10-19 09:07:02647browse

How to Fix

Fixing "stream_socket_enable_crypto(): SSL operation failed with code 1" Error

When attempting to send emails using Laravel 4.2 with SSL enabled, you may encounter the error:

"stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed"

This error indicates a failure in SSL verification. To resolve this issue, you can disable SSL verification by adding the following code to your /config/mail.php file:

<code class="php">'stream' => [
    'ssl' => [
        'allow_self_signed' => true,
        'verify_peer' => false,
        'verify_peer_name' => false,
    ],
],</code>

Note: Disabling SSL verification poses security risks, as it allows attackers to impersonate trusted endpoints and perform Man-in-the-Middle Attacks. Only use this solution if you fully understand the potential security implications.

After adding this code, your email sending should function correctly.

The above is the detailed content of How to Fix \'stream_socket_enable_crypto(): SSL operation failed with code 1\' Error in Laravel 4.2?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn