I am getting file_get_contents returning SSL routines:ssl3_get_server_certificate:certificate

41 views Asked by At

I'm getting the following error when I use file_get_contents with a URL from another server.

Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /home/test/public_html/.....

Warning: file_get_contents(): Failed to enable crypto in /home/test/public_html/...... on line 24

Warning: file_get_contents(https://......): failed to open stream: operation failed in /home/test/public_html/......php on line 24

This is my 4th VPS. The first 3 work absolutely fine but this one for some reason gives the above error. The setup on this VPS is identical.

Notes:

  • allow_url_fopen is On
  • The https on the target server is fine
  • SSLv3 have been disabled on the target server due to it being deprecated.

It works when I use:

$arrContextOptions=array(
   "ssl"=>array(
        "verify_peer"=>false,
         "verify_peer_name"=>false,
   ),
);

But some plugins use file_get_contents and I can't modify it due to updates.

What could the issue be?

1

There are 1 answers

0
DevSavata On

Few days back i also gone through similar situation this link might belp