I am getting this error message when I try to use curl on Ubuntu 16.04:

curl: (60) server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt

I have downloaded cacert.pem and put the path to it in php.ini and set env variable CURL_CA_BUNDLE but it still fails.

curl: (60) server certificate verification failed. CAfile: /var/www/cacert/cacert.pem CRLfile: none

I can view the site I am trying to curl from and it give no SSL errors and the cert is issued by GoDaddy.

I need curl in a PHP application where I can’t change the code (WordPress plugin) so using -k or --insecure doesn't help as I can't modify calling code.

Any ideas?

  • Did you restart the webserver after changing php.ini? Have you checked the output of phpinfo() to make sure you changed the right php.ini (many installations have more than one)? – ceejayoz Mar 7 '17 at 17:32
  • Yes, also on the second error message it outputs the path to the cacert.pem file I downloaded. – Guerrilla Mar 7 '17 at 17:34
  • And you're certain you have the latest version of curl.haxx.se/ca/cacert.pem (Wed Jan 18 04:12:05 2017 GMT)? What domain name are you cURLing? – ceejayoz Mar 7 '17 at 17:36
  • yep, downloaded from that url today. Domain name is zanedo.com (I am downloading images) – Guerrilla Mar 7 '17 at 17:44
  • I just restarted again and now I can use it on command line but not in the application still. phpinfo() shows curl enabled but doesn't show curl.cainfo path, not sure if its meant to? – Guerrilla Mar 7 '17 at 17:51

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.