Unable to get local issuer certificate mailchimp

Viewed 278

I am getting this error GuzzleHttp\Exception\RequestException cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://us20.api.mailchimp.com/3.0/ping every time i go on the website\ping

In .env i have inserted my api key like this:

'MAILCHIMP_KEY=apikey-us20'  (didn't put the api key on stackoverflow)

In my route file web.php i have it like this :

Route::get('ping', function () {


   $mailchimp = new \MailchimpMarketing\ApiClient();

   $mailchimp->setConfig([
       'apiKey' => config('services.mailchimp.key'),
       'server' => 'us20'
   ]);

   $response = $mailchimp->ping->get();
       // $response = $mailchimp->lists->getAllLists();

   ddd($response);
});

And in config\services.php

return [

    'mailgun' => [
        'domain' => env('MAILGUN_DOMAIN'),
        'secret' => env('MAILGUN_SECRET'),
        'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
    ],

    'postmark' => [
        'token' => env('POSTMARK_TOKEN'),
    ],

    'ses' => [
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
    ],

    'mailchimp' => [
        'key' => env('MAILCHIMP_KEY')
    ]
];

If I go to this link https://us20.api.mailchimp.com/3.0/ping

I get :

{"type":"https://mailchimp.com/developer/marketing/docs/errors/","title":"API Key Invalid","status":401,"detail":"Your request did not include an API key.","instance":"6729ff8b-f427-9766-b26f-b77bf83fa68a"}

I am useing wampserver 3.2.3, PHP 7.4.9, Laravel 8.76.2
I don't know how to fix it.

1 Answers

Error Message: API call to helper/ping failed: SSL certificate problem: unable to get local issuer certificate.

Ways to fix this issue: The most reasonable solution for a localhost install is to download a local copy of the necessary CA certs. Once downloaded you can add them to the necessary location and make changes to your localhost server config files to properly reference them.

  1. Download cacert.pem file from here: http://curl.haxx.se/docs/caextract.html
  2. Save the file in your PHP installation folder. (eg: If using xampp – save it in c:\Installation_Dir\xampp\php\cacert.pem).
  3. Open your php.ini file and add this line:
  4. curl.cainfo='C:\Installation_Dir\xampp\php\cacert.pem'
  5. Restart your Web server and that should fix it (Simply stop and start the services as needed).

Source: https://yikesplugins.com/knowledge-base/i-receive-the-error-ssl-certificate-problem-unable-to-get-local-issuer-certificate-why/

Related