phpsslcurllocalhostmamp

MAMP local development - cURL error 60: SSL certificate: unable to get local issuer certificate


I use MAMP as local development environment. I want to implement a Google Auth - but keep getting this SSL Error.

  1. As other SO topics suggest, I already added this line of code in my PHP.ini file:
curl.cainfo ="C:/MAMP/bin/php/php7.4.1/extras/ssl/cacert.pem"
  1. and added the latest CA certificate from here: https://curl.se/docs/caextract.html in my PHP SSL folder: C:\MAMP\bin\php\php7.4.1\extras\ssl

Any ideea how to pass this SSL error on my local enviroment?

This is the code:

$google_client = new \Google_Client();
    $google_client->setClientId($clientID);
    $google_client->setClientSecret($clientSecret);
    $google_client->setRedirectUri($redirectUri);
    $google_client->addScope("email");
  $google_client->addScope("profile");



    if($this->request->getVar('code')){
        $token = $google_client->fetchAccessTokenWithAuthCode($this->request->getVar('code'));
        if(!isset($token['error'])){
            $google_client->setAccessToken($token['access_token']);
            $this->session->set('access_token', $token['access_token']);

            //get Google profile data
            $google_service = new \Google_Service_Oatuth2($google_client);
            $data = $google_service->userinfo->get();
            print_r($data);


Solution

  • Update the location of the cacert.pem in your openssl.cnf file to point to the latest version you got from curl.se and you should be right.