title: CURL: SSL certificate fails, verify that the CA cert is OK
body: <p>I am running a local XAMPP server on a windows machine.</p>
  
  <p>From this server I am trying to connect to an SSL encrypted page via CURL.</p>
  
  <p>I did run into the following error:</p>
  
  <pre><code>SSL certificate problem, verify that the CA cert is OK. Details:
  error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
  </code></pre>
  
  <p>I realize that I <em>could</em> simply disable SSL verification by using...</p>
  
  <pre><code>curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  </code></pre>
  
  <p>..but I really don´t want to do this, that´s the point of using SSL.</p>
  
  <p>I´ve seen several answers here that point to to set the CURL Option "CURLOPT_CAINFO" to a .pem file that can be acquired here: <a href="http://curl.haxx.se/ca/cacert.pem" rel="nofollow">http://curl.haxx.se/ca/cacert.pem</a></p>
  
  <pre><code>curl_setopt($ch, CURLOPT_CAINFO, 'C:\xampp\cacert.pem' );
  </code></pre>
  
  <p>I did put the file in the given folder, and run the above command before running curl_exec. But I still get the same error as before.</p>
  
  <p>I also tried to download the certificate from the site that I am trying to connect with, but the error message is still the same.</p>
  
  <p>PHP can access the .pem file, with file_get_contents for example, so it does not appear to be a file access / permission problem.</p>
  
  <p>What could be the cause for this problem to persist?</p>
  
  <p>I am running:</p>
  
  <ul>
  <li>PHP Version: 5.2.9</li>
  <li>cURL Information: libcurl/7.16.0 OpenSSL/0.9.8i zlib/1.2.3</li>
  </ul>