PHP SSL routines:ssl3_get_server_certificate:certificate verify failed

When PHP client fails to handshake with the server using provided certificate files, it throws error SSL routines:ssl3_get_server_certificate:certificate verify failed.

There could be invalid certificate files which is causing the handshake failed. So, you should check the correctness of the provided certificate file. Here is how to check if the provided certificate files are valid.

But, a common cause to the error is at the PHP client side. You may try below SSL Options to make connection when you receive 'certificate verify failed' error.

$ssl_options = [
                 'cafile' => '/path/to/cacert.pem',
                 'local_cert' => '/path/to/key-cert.pem',
                 'verify_peer' => false,
                 'verify_peer_name' => false,
               ];

PS: In PHP, you should pass the concatenated key.pem and cert.pem files.