cURL error 60: SSL certificate problem: unable to get local issuer certificate

Discussion in 'Linux Guides' started by Chuck, Dec 8, 2017.

  1. Chuck

    Chuck Administrator
    Staff Member Grep What?

    Joined:
    May 17, 2017
    Messages:
    39
    Likes Received:
    0
    If you run into this error on servers it is most likely the destination server that has an SSL issue. To confirm that curl + SSL is good on your account / server here at kickassd you can use the following script:

    Code:
    <?php
    function kic_cURLTest($url, $msg, $testText){
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36");
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_TIMEOUT, 10);
      curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
      $response = curl_exec($ch);
      $errmsg = curl_error($ch);
      $cInfo = curl_getinfo($ch);
      curl_close($ch);
      echo "Testing ... ".$url." - ".$cInfo['url']."<br />";
      if (stripos($response, $testText)!==false)
        echo "....".$msg." - OK<br />";
      else
      {
        echo "....<b style='color:red;'>".$msg." - Problem</b><br /><pre>";
        print_r($errmsg);
        print_r($cInfo);
        print_r(htmlentities($response));
        echo "</pre>There is a problem with cURL. You need to contact your server admin or hosting provider.";
      }
    }
     
      kic_cURLTest("http://www.google.com/intl/en/contact/", "HTTP to Google", "Mountain View, CA");
      kic_cURLTest("https://www.google.com/intl/en/contact/", "HTTPS to Google", "Mountain View, CA");
      kic_cURLTest("https://www.facebook.com/", "HTTPS to Facebook", 'id="facebook"');
      kic_cURLTest("https://graph.facebook.com/", "HTTPS to API (Graph) Facebook", 'get');
      kic_cURLTest("https://www.linkedin.com/nhome/", "HTTPS to LinkedIn", 'rel="canonical" href="https://www.linkedin.com/');
      kic_cURLTest("https://twitter.com/", "HTTPS to Twitter", '<link rel="canonical" href="https://twitter.com');
      kic_cURLTest("https://www.pinterest.com/", "HTTPS to Pinterest", 'content="Pinterest"');
    ?>

    This should return all "OK". Now you will want to check the destination SSL, you can do this by entering the URL at:
    https://www.sslshopper.com/ssl-checker.html

    Most likely it is going to show a broken chain and the admin of that server will need to fix it.



    If the above script shows a problem and you are not hosted on Kickassd you will need to diagnose this issue and repair it. It could be one of many things as is beyond the scope of this article. Try asking in the Web Hosting Help forum if you require further help.
     
    #1 Chuck, Dec 8, 2017
    Last edited: Dec 8, 2017

Share This Page