Curl error 60: ssl certificate problem: unable to get local issuer certificate mamp

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

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

2022-08-01T08:13:58+00:00 2022-08-01T08:13:58+00:00

1243

I use MAMP as local development environment. anycodings_mamp I want to implement a Google Auth - but keep anycodings_mamp 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 anycodings_mamp 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);

Total Answers 2

27

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

Setting the value for "curl.cainfo" anycodings_localhost didn't help me. Instead i had to set the anycodings_localhost value in the "openssl"-section of my anycodings_localhost current php.ini (Find the current anycodings_localhost "php.ini"-file in shell with command anycodings_localhost 'which php'.):

Uncomment and set the openssl.cafile anycodings_localhost (path is for MacOS):

openssl.cafile="/Applications/MAMP/Library/OpenSSL/certs/cacert.pem"

(Downloaded the pem-file as suggested anycodings_localhost from https://curl.se/docs/caextract.html anycodings_localhost )

0

2022-08-01T08:13:58+00:00 2022-08-01T08:13:58+00:00Answer Link

mRahman

5

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

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

0

2022-08-01T08:13:58+00:00 2022-08-01T08:13:58+00:00Answer Link

raja

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

Solutions

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');

Similar questions

Use Curl SSL Certificate in Wordpress Plugin

I have the following code: When I run just this code, everything works properly. (including SSL certificate). But, When I use this code in WP plugin, there is: curl_error: unable to use client certificate (no key found or wrong pass phrase?) I think there are some hidden filters within Wordpress core and they blocks/edits my ssl Curl request. How c...

My HTTP request works with cURL but with wp_remote_get() I get error 403 (Forbidden)

I am working on a WordPress plugin in which I must retrive product data from ShipHero's API. When using cURL, I get a sucessful JSON. My code: This is the response I get: I am supposed to use the helper function wp_remote_get() instead. This is my code: But what I get is a 403 message (Missing Authentication Token): I have already tried to override...

SSL certificate verify failed over plain HTTP (non-SSL) in WordPress update

I'm trying to update WordPress itself along with plugins and themes. Update WordPress Downloading update from http://downloads.wordpress.org/release/wordpress-4.4.1-new-bundled.zip… Download failed.: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed Ins...

WooCommerce: Unable to write certificate file during cURL configuration

I'm setting PayPal Express Checkout in WooCommerce. I've set API keys and certificate, but after saving it I got error "Error: Sorry, Easy Setup encountered an error. Please try again.". In log then I see following error: 07-08-2016 @ 11:27:22 - WC_Gateway_PPEC_Client::_request: exception is thrown while trying to make a request to PayPal: Unable t...

wp_remote_get - cURL error 28 - only on same domain

On my website I use wp_remote_get to fetch data from mydomain.com/wp-json/wp/v2/pages/75 When I run it on my localhost it works fine, but after sending to production server (mydomain.com) suddenly I’m getting error: ‘cURL error 28: Operation timed out after 5000 milliseconds with 0 bytes received’ + VPS starts acting crazy (100% cpu usage and memor...

Also ask

How to solve curl error 60 ssl certificate problem unable to get local issuer certificate?

Error “curl: (60) SSL certificate problem: unable to get local issuer certificate” can be seen when the SSL certificate on the server is not verified or properly configured. In order to fix this please follow the steps below: Download the latest cacert. pem from https://curl.haxx.se/ca/cacert.pem.

How do you fix a curl Error 60?

Solution:.
Save the cacert. pem file anywhere on your system. Example: Since you're modifying both php. ... .
Open your php.ini file. If your php.ini file doesn't have the curl.cainfo line, just add it to the end of the file, then add the file path where you saved your cacert.pem file: ... .
Restart your server..

How do I fix curl 60 ssl certificate problem certificate has expired?

The only solution to this problem is to get your host to update the root certificate on your server. So, you need to contact your server host and ask them to insert a new cacert. pem file into their servers, and configure it within their php.

How do I fix unable to get local issuer certificate?

When ssl certificate problem unable to get local issuer certificate error is caused by a self-signed certificate, the fix is to add the certificate to the trusted certificate store. Open the file ca-bundle. crt located in the directory above, then copy and paste the Git SSL certificate to the end of the file.