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?

Image of Datadog

The Future of AI, LLMs, and Observability on Google Cloud

Datadog sat down with Google’s Director of AI to discuss the current and future states of AI, ML, and LLMs on Google Cloud. Discover 7 key insights for technical leaders, covering everything from upskilling teams to observability best practices

Learn More

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Retry later