title: Issues with cURL connections - error setting certificate verify location
body: <p>We have been struggling with cURL since we've had our new server (no issues previously). In the last 6 months we've searched and tried to fix the issue at the root, with no success.</p>
  
  <p>We are running an Ubuntu 16.04 server, with a Codeigniter project on PHP and Nginx. </p>
  
  <p>The (composer) package we are currently having the issue with is the Mailgun API (which extends the composer package <code>php-http</code>)</p>
  
  <p>Below is the error that we get when connecting via cURL</p>
  
  <pre><code>An uncaught Exception was encountered
  
  Type: Http\Client\Exception\RequestException
  
  Message: error setting certificate verify locations: CAfile: /etc/ssl/certs/ca-bundle.crt CApath: /etc/ssl/certs
  
  Filename: /var/www/ domain /vendor/php-http/curl-client/src/Client.php
  
  Line Number: 137
  </code></pre>
  
  <p>The only solution that has worked for us so far disabling <code>CURLOPT_SSL_VERIFYPEER</code>, but we've had to do that inside the composer package, which obviously is not a proper solution.</p>
  
  <p>I'm hoping someone here can please shed some light on how we might be able to resolve the issue.</p>
  
  <p>What we have tried so far: </p>
  
  <ul>
  <li>Checked the date on the server</li>
  <li>Disable <code>CURLOPT_SSL_VERIFYPEER</code>, but not a viable solution</li>
  <li>Set <code>.curlrc</code> file (but issue is that webserver user is executing, so no place to put it?</li>
  <li>Checked the <code>/etc/ssl/certs/</code> folder to see if the files exist.</li>
  <li><code>sudo update-ca-certificates --fresh</code></li>
  </ul>
  
  <p>File permissions on the folder</p>
  
  <pre><code>root@Ubuntu-1604-xenial-64-minimal /etc/ssl/certs # ls -la ca*
  lrwxrwxrwx 1 root root     37 Apr 26 11:17 ca6e4ad9.0 -&gt; ePKI_Root_Certification_Authority.pem
  -rwxrwxrwx 1 root root 274340 Mar  8 17:09 ca-bundle.crt
  -rwxrwxrwx 1 root root 274340 Apr 26 11:25 ca-certificates.crt
  -rwxrwxrwx 1 root root 261889 Jan 18 06:12 cacert.pem
  -rwxrwxrwx 1 root root 261889 Jan 18 06:12 cacert.pem.txt
  </code></pre>