cURL looking for CA in the wrong place

Posted by andrewtweber on Server Fault See other posts from Server Fault or by andrewtweber
Published on 2012-12-05T22:20:16Z Indexed on 2012/12/05 23:06 UTC
Read the original article Hit count: 269

Filed under:
|
|
|

On Redhat Linux, in a PHP script I am setting cURL options as such:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, True);
curl_setopt($ch, CURLOPT_CAINFO, '/home/andrew/share/cacert.pem');

Yet I am getting this exception when trying to send data

(curl error: 77) error setting certificate verify locations:
CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none

Why is it looking for the CAfile in /etc/pki/tls/certs/ca-bundle.crt? I don't know where this folder is coming from as I don't set it anywhere.

Shouldn't it be looking in the place I specified, /home/andrew/share/cacert.pem? I don't have write permission /etc/ so simply copying the file there is not an option. Am I missing some other curl option that I should be using?

(This is on shared hosting - is it possible that it's disallowing me from setting a different path for the CAfile?)

© Server Fault or respective owner

Related posts about php

Related posts about https