MainelyDesign.com Blog

Making CURL SSL Work on Localhost PHP Development in Windows

Posted on 08/08/2014 at 09:52 am by Kevin Wentworth
Viewed 13,739 times | 0 comments

I've been here before.  Working on a Facebook application on my local development box and none of the access tokens will work.  They work on the live server, but not on my sandbox/development server.  What gives?

CURL is failing to communicate over SSL/HTTPS

If you dig into the code and look at the curl error being reported, you'll see this message:

SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

That sounds ominous.  But I know I had it working at some point in the past.  The culprit here: I reinstalled PHP on my computer and forgot a key CURL setting.  To get curl working over SSL connections on PHP for Windows (without disabling the SSL check using curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);) you'll have to modify your PHP.ini.  (or update all your code... no thanks!).

Add PHP.ini Setting for curl.cainfo

The fix is easy.  Open up your php.ini file and add the following line (there won't be any curl options if you are using WAMP).

  1. curl.cainfo = "C:\path\to\cacert.pem"

Cheers,
-Kevin Wentworth

Bookmark and Share

Tags for Making CURL SSL Work on Localhost PHP Development in Windows

Web Programming | Web Server Admin | Windows | Php | Usage | Setup

Comments for this Posting

No comments. Be the first to post a reply.

Sorry, comments are closed for this posting.

Please Email Kevin if you have any questions. Thanks!

Meet Site Avenger - Hosted Content Management System

Powered By: Site Avenger | Site Production: Saco Design