How to fix the Curl Error: error setting certificate verify locations

Today I had a new server running CentOS5 have trouble with a known good library using curl.  It was producing the following error:

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

After some research I found it was based on the inability for the apache user to access the ca-bundle.crt file. You will find solutions on the web suggesting adding curl_setopt($link, CURLOPT_SSL_VERIFYPEER, FALSE); to your script to disable the peer verification – I suggest you not do this and simply fix the permissions for your CA file.

Execute this:

/bin/chmod 755 /etc/pki/tls/certs


This post is licensed under CC BY 4.0 by the author.