I have a script that is returning an error. The script uses cURL to fetch a remote site. Here is the error:

Fatal error: Uncaught exception 'Exception' with message 'Could not retrieve page:CURL failed to fetch page:SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed' in /home/user/public_html/file.php:66 Stack trace: #0 {main} thrown in /home/user/public_html/file.php on line 66

This error is not entirely surprising because when I visit the URL using FireFox 2, I get a certificate warning on the page. Interestingly, I get no such warning when using IE7 or Safari 3. I'm using a windows machine. Anyone know why they might behave differently when visiting the exact same site?

Anyway, I tried googling around and learned that this problem could be caused by the certificate authority for this site (Verisign) isn't trusted by cURL. Apparently that would be caused by Verisign's credentials being missing from some 'CA cert bundle'. This is where my grasp gets a bit shaky.

I know that I can access the site if I do this:

	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

but I'm guessing that's a not such a good idea. I want to be sure this connection is secure and that I'm talking to whoever I think I'm talking to.

Can anyone advise me on how to fix this problem?

Here is the script:

    Here's a link on how to update your root certificate cache for curl on linux.

    Here's a post that shows how you can, alternately, choose another path to your root certificates (one's that are up to date.)

      Write a Reply...