Getting error in Curl - Peer certificate cannot be authenticated with known CA certificates Getting error in Curl - Peer certificate cannot be authenticated with known CA certificates curl curl

Getting error in Curl - Peer certificate cannot be authenticated with known CA certificates


By default CURL will generally verify the SSL certificate to see if its valid and issued by an accepted CA. To do this, curl uses a bundled set of CA certificates.

If you'd like to turn off curl's verification of the certificate, use the -k (or --insecure) option. Here's an example:

curl --noproxy -k \* -D - https://127.0.0.1:443/some-secure-endpoint


For php it is possible to switch off curl's verification of the certificate (see warning below) e.g. for curl_exec

  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

http://php.net/manual/en/function.curl-setopt.php

(evaluate the security risk yourself, in my case it was on a partner company's server and the file required contained no secure information - just happened to be on a secure server)


We fixed a similar issue on CentOS 6 by updating curl to the latest version available in the standard repositories and installing the newest ca-certificates bundle:

yum update curlyum install ca-certificates