title: cURL complaining on local SSL https requests
body: <p>I have an Ubuntu LAMP server on Digital Ocean and have setup an SSL certificate (which works perfectly fine). The website runs via https (http requests are redirected to https). In one of my PHP scripts, I have to send a cURL request to the local server. I am basically sending a POST request with JSON data that will be used for templating a document at the other end. In short, both ends are hosted at the same site:</p>
  
  <ul>
  <li><code>https://example.com/form.php</code></li>
  <li><code>https://example.com/templates/document.php</code></li>
  </ul>
  
  <p>The cURL error I get when sending data from <code>form.php</code> to <code>templates/document.php</code> is:</p>
  
  <blockquote>
    <p>SSL certificate problem: unable to get local issuer certificate</p>
  </blockquote>
  
  <p>I have read at least 20 articles telling me to add these lines to php.ini at their original line positions:</p>
  
  <ul>
  <li><code>curl.cainfo="/etc/ssl/certs/cacert.pem"</code></li>
  <li><code>openssl.cafile="/etc/ssl/certs/cacert.pem"</code></li>
  </ul>
  
  <p>The CA certificate is located as described above, but the cURL error persists.</p>
  
  <p>I am able to bypass this error by forcing <code>CURLOPT_SSL_VERIFYPEER</code> to <code>false</code> in the cURL request itself. However, I know this is not an option for a website in production mode.</p>
  
  <p>Is it not possible to do such SSL cURL request to its own host? Or is it so that I can actually disable <code>CURLOPT_SSL_VERIFYPEER</code> for this very specific request since it's just a local request anyway?</p>
  
  <p>Thank you in advance!</p>
  
  <p>EDIT:</p>
  
  <p>Adding a verbose option to the cURL request shows the following information:</p>
  
  <blockquote>
    <ul>
    <li>Trying 123.456.789.01...</li>
    <li>Connected to example.com (123.456.789.01) port 443 (#0)</li>
    <li>ALPN, offering http/1.1</li>
    <li>Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH</li>
    <li>successfully set certificate verify locations:</li>
    <li>CAfile: /etc/ssl/certs/cacert.pem   CApath: /etc/ssl/certs</li>
    <li>SSL certificate problem: unable to get local issuer certificate</li>
    <li>Closing connection 0</li>
    </ul>
  </blockquote>
  
  <p>It doesn't seem to be of any help though.</p>