Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Local WordPress & MAMP wp_remote_get(): cURL error 60: SSL certificate problem: unable to get local issuer certificate

I have a site running locally on MAMP Pro (macos) and keep getting cURL errors when I use wp_remote_get()

I've searched and tried multiple solutions, but nothing seems to work.

My code:

$url = site_url() . '/wp-json/wp/v2/my-cpt'; // This works just fine and shows up in the browser correctly
$response = wp_remote_get( $url ); // this outputs the cURL error: "cURL error 60: SSL certificate problem: unable to get local issuer certificate"

I have:

  1. Downloaded the latest CA file from https://curl.haxx.se/docs/caextract.html
  2. Replaced the cacert.pem file in my MAMP OpenSSL install: /Applications/MAMP/Library/OpenSSL/certs/cacert.pem
  3. Opened the two relevant php.ini files. One is located at /Applications/MAMP/conf/php7.4.2/php.ini and the other at /Applications/MAMP/bin/php/php7.4.2/conf/php.ini
  4. Added the URL to the new cacert.pem curl.cainfo = "/Applications/MAMP/Library/OpenSSL/certs/cacert.pem" openssl.cafile = "/Applications/MAMP/Library/OpenSSL/certs/cacert.pem" openssl.capath = "/Applications/MAMP/Library/OpenSSL/certs"
  5. I also tried specifying curl.cainfo, openssl.cafile, openssl.capath via the MAMP GUI: File > Edit Template > PHP(php.ini) > 7.4.2
like image 972
Ryan Dorn Avatar asked Dec 07 '25 10:12

Ryan Dorn


1 Answers

This is more of a local work around. You can disable SSL verification within your local site. This can be accomplished by adding this line into the file wp-includes/functions.php or /wp-content/themes/YOUR_THEME/functions.php

add_filter('https_ssl_verify', '__return_false');
like image 56
Help Inspire Avatar answered Dec 08 '25 22:12

Help Inspire