F
F
FulgerX20072019-07-08 10:18:14
PHP
FulgerX2007, 2019-07-08 10:18:14

Why is readfile() throwing an ssl error?

Hi all.
Such situation .
There is an API: API with a self-signed certificate. There is a code:$url = 'https://x.x.x.x/api.php';

// стандартные опции для отключения проверки SSL
$opts = [
            'ssl' => [
                'verify_peer' => false,
                'verify_peer_name' => false,
            ]
        ];
$context = stream_context_create($opts);

// данная функция работает нормально без проблем
readfile($url,false,$context);

// данный вариант выдает ошибку 
// при использования фильтра для потока
stream_filter_register('ssf', 'StringStreamFilter')
readfile('php://filter/ssf/resource=' . $url, false, $context);

Mistake :

Warning : readfile(): SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Sokharev, 2019-07-08
@greabock

If you're running code locally, the most common cause of broken TLS certificates is antivirus software. Try disabling scanning of secure (encrypted) connections in your antivirus settings.

C
CityCat4, 2019-07-08
@CityCat4

Because the certificate is not trusted.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question