DEV Community

Dimitrios Desyllas
Dimitrios Desyllas

Posted on

Why php does not verify the certificate using my ca cert installed globally?

As I ask upon I have some trouble verifying my certificates using my own ca files:

https://stackoverflow.com/q/77366755/4706711

I try to do the following directly from php interpreter (via running php -a):

$contents = file_get_contents("https://custom_ca_url.local");
Enter fullscreen mode Exit fullscreen mode

But I get the error:

PHP Warning:  file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in php shell code on line 1
PHP Stack trace:
PHP   1. {main}() php shell code:0
PHP   2. file_get_contents(*uninitialized*) php shell code:1
PHP Warning:  file_get_contents(): Failed to enable crypto in php shell code on line 1
PHP Stack trace:
PHP   1. {main}() php shell code:0
PHP   2. file_get_contents(*uninitialized*) php shell code:1
PHP Warning:  file_get_contents(https://polihome.local): failed to open stream: operation failed in php shell code on line 1
PHP Stack trace:
PHP   1. {main}() php shell code:0
PHP   2. file_get_contents(*uninitialized*) php shell code:1
Enter fullscreen mode Exit fullscreen mode

Any idea why that happens?

Top comments (0)