PHP validation error using LetsEncrypt

Problem while trying to read stream:

$result = file_get_contents($url, false, stream_context_create(
    ['http' => ['timeout' => (float) $this->options['timeout']]]
));

Failed to perform SSL operation with code 1. OpenSSL error messages:

Error: 14090086: SSL routines: ssl3_get_server_certificate: certificate verification failed

Before I answer, I'm not going to do

 "ssl"=>array(
        "verify_peer"=>false,
        "verify_peer_name"=>false,
    ),

In the hope that someone else is using letencrypt and has the proper way to make sure it is verified.

feel free to check my certificate in my domain lukepolo.com

+4
source share
2 answers

openssl.cafile = curl.cainfo =

in your php.ini, you need both

+3
source

, , CA ( CA). , , . PEM ,

$result = file_get_contents($url, false, stream_context_create(
    [
        'http' => ['timeout' => (float) $this->options['timeout']],
        'ssl' => ['cafile' => '/path/to/file.pem']
    ]
));
+1

Source: https://habr.com/ru/post/1622116/


All Articles