PHP - SSL certificate error: unable to get local issuer certificate

前端 未结 16 2728
时光取名叫无心
时光取名叫无心 2020-11-21 07:49

I\'m running PHP Version 5.6.3 as part of XAMPP on Windows 7.

When I try to use the Mandrill API, I\'m getting the following error:

Uncaught e

16条回答
  •  感动是毒
    2020-11-21 07:57

    I was facing a problem like this in my local system but not in the live server. I also mentioned another solution on this page its before, but that was not working in localhost.so find a new solution of this, that is working in the localhost-WAMP Server.

    cURL Error #:SSL certificate problem: unable to get local issuer certificate

    sometimes system could not find your cacert.pem in your drive. so you can define this in your code where you are going to use CURL

    Note that i am fulfilling all conditions for this like OPEN-SSL library active and other things.

    check this code of CURL.

     $curl = curl_init();
     curl_setopt_array($curl, array(
                CURLOPT_URL =>$url,
                CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                CURLOPT_CUSTOMREQUEST => "GET",
                CURLOPT_RETURNTRANSFER=> true,
            ));
    curl_setopt($curl, CURLOPT_CAINFO, "f:/wamp/bin/cacert.pem"); // <------ 
    curl_setopt($curl, CURLOPT_CAPATH, "f:/wamp/bin/cacert.pem"); // <------
    $response = json_decode(curl_exec($curl),true);
    $err = curl_error($curl);
    curl_close($curl);
    

    but this solution may not work in live server. because of absolute path of cacert.pem

提交回复
热议问题