How do I Install Mailchimp PHP Library on Local

Issue Summary

How do I install Mailchimp PHP Library on Local? I don’t want to use Wordpress Mailchimp plug-in.

System Details

  • Local v 5.9.0+4961

  • Windows 10

Using MailChimp PHP Library with Local by Flywheel -
Solve CURL error 60 when using MailChimp PHP Library with Local by Flywheel

  1. Install MailChimp’s PHP Library using Composer command from the Local Site Shell provided with Local by Flywheel
    C:[path to]\Local Sites[site name]\app\public> composer require mailchimp/marketing

  2. The following MailChimp PHP is used to test connectivity between your PHP program and MailChimp (https://mailchimp.com/developer/guides/marketing-api-quick-start/)

<?php require_once('/path/to/MailchimpMarketing/vendor/autoload.php'); $mailchimp = new \MailchimpMarketing\ApiClient(); $mailchimp->setConfig([ 'apiKey' => 'YOUR_API_KEY', 'server' => 'YOUR_SERVER_PREFIX' ]); $response = $mailchimp->ping->get(); print_r($response); ?>
  1. Local by Flywheel shows the following error when the PHP code is executed:

GuzzleHttp\Exception\RequestException: cURL error 60: SSL certificate problem: self signed certificate in certificate chain (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) in C: [path to]\Local Sites[site name]\app\public\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 201

  1. A further look into the error shows that it is a CURL Error 60:

CURLE_PEER_FAILED_VERIFICATION (60)

The remote server’s SSL certificate or SSH md5 fingerprint was deemed not OK. This error code has been unified with CURLE_SSL_CACERT since 7.62.0. Its previous value was 51.

  1. To solve this problem, the Local by Flywheel environment needs to be configured correctly.

  2. Download the latest cacert.pem file from https://curl.haxx.se/docs/caextract.html

  3. Copy the cacert.pem file to the “[path to]\Local Sites[site name]\conf\php” directory

  4. Edit the “[path to]\Local Sites[site name]\conf\php\php.ini.hbs” file by adding the following line to the ;Other section of php.ini.hbs file:
    curl.cainfo=“C:[path to]\Local Sites[site name]\conf\php\cacert.pem”

NOTE: Making these changes to the php.ini file directly will not work. They must be made to the php.ini.hbs file.

  1. Stop and restart Local by Flywheel

  2. Execute script again and you should get the result:
    stdClass Object ( [health_status] => Everything’s Chimpy! )

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.