Skip Navigation
Expand
cURL CAPath to use with CPHP API
Answer ID 10601   |   Last Review Date 11/07/2019

Why am I getting an "error setting certificate verify locations:CApath:none" when accessing the location of a certificate with cURL?

Environment

Connect for PHP (CPHP) API

Resolution

When using cURL in Connect for PHP (CPHP) API and referencing the path to the certificate used to establish connection, one needs to take into account the directory into which the certificate has been uploaded in the console File Manager.

If the certificate has been added to the Additional root certifcates, then the cURL path to use is:

CURLOPT_CAINFO=> '/cgi-bin/[site name].db/certs/ca/CERTFILENAME.pem'

If the certificate has been added to the Intermediate certificates, then the cURL path to use is:

CURLOPT_CAINFO=>'/cgi-bin/[site name].db/certs/uca/CERTFILENAME.pem'

Further, using the CURLOPT_CAINFO option will be necessary when using the CURLOPT_SSL_VERIFYPEER option. In that case you will find this set of options helpful (using the default cert in this case):

CURLOPT_SSL_VERIFYPEER =>true
CURLOPT_SSL_VERIFYHOST =>2
CURLOPT_CAINFO=>'/cgi-bin/[site name].db/certs/ca.pem'

Available Languages for this Answer:

Notify Me
The page will refresh upon submission. Any pending input will be lost.