CURL error SSL certificate problem: unable to get local issuer certificate xampp

XAMPP를 사용해서 Widnow 개발 환경을 설정한 경우가 있었습니다.

이 때, php 에서 curl 을 이용하는 경우에 아래와 같은 오류가 발생했었습니다.

"cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)"

처음 접한 에러라 인터넷 검색을 통해 해결했습니다.


https://curl.haxx.se/docs/caextract.html 에서 cacert.pem 다운로드 받습니다.

CURL error SSL certificate problem: unable to get local issuer certificate xampp

다운로드 받은 파일을 C:\xampp\php\extras\ssl\cacert.pem 디렉토리에 넣어줍니다.


 

php.ini("c:\xampp\php\php.ini")에서 `curl.cainfo` 를 찾아 다음 같이 값을 넣어주세요.

curl.cainfo 를 찾을 수 없다면 맨 뒤 마지막 줄에 아래 내용을 추가해주세요.

;;;;;;;;;;;;;;;;;;;; ; php.ini Options ; ;;;;;;;;;;;;;;;;;;;; curl.cainfo = "C:\xampp\php\extras\ssl\cacert.pem"

그 후 웹서버 (Apache) 를 다시 실행시켜 주세요.

Hello,

I am trying to rebuild our PHP scripts with the new Client. For that, i want to use my local deveolpement environment with XAMPP on Windows 7.

Installing Composer and the AdWords API Package was no Problem.

But when i try to start a changed Script, based on one of the Reporting Examples, i get the following Error:

Fatal error: Uncaught exception 'GuzzleHttp\Exception\RequestException' with message 'cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)' in C:\Users\ladewig\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:187 Stack trace: #0 C:\Users\ladewig\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(150): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array) #1 C:\Users\ladewig\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(103): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory)) #2 C:\Users\ladewig\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory)) #3 C:\Users\ladewig\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php(28): Gu in C:\Users\ladewig\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 187

What i have done so far to fix the problem:

  • changed php.ini to curl.cainfo = "C:\Internet\xampp\php\extras\ssl\cacert.pem" (That's exact the location of the file)
  • changed php.ini to openssl.cafile = "C:\Internet\xampp\php\extras\ssl\cacert.pem"
  • Checked if C:\windows\system32\curl-ca-bundle.crt exists (Windows) - Yes
  • Checked if C:\windows\curl-ca-bundle.crt exists (Windows) - Yes
  • put 2 dll files to windows\system32 (can't find the post anymore to give you the dll-names)

I am using XAMPP 3.2.1 with PHP 5.6.3

What else could be the problem or which Information do you need to do a deeper analysis of the Isue.

Article Last Updated: March 4, 2021

Error Message:

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

Error Explination:

There are a number of reasons you might be seeing this error message. We will outline the two most common causes of this error and how to fix them:

Local Host Installations using MAMP/XAMPP etc.

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”
4) Restart your Apache server and that should fix it (Simply stop and start the services as needed).

If the above steps are too complicated, see the snippet below for a quick alternative workaround.


Sites on Remote Hosts (Hostgator, Bluehost etc.)

The cURL extension (which is used by WordPress for remote communication) must be able to verify the SSL certificate for any remote site that Easy Forms for Mailchimp by YIKES connects to. If your copy of WordPress is not equipped with a root CA bundle that can perform a lookup on the SSL certificate for Mailchimp you will most likely run into problems.

Ways to fix this issue:
1) The first, and most successful, solution is to contact hosting company and request assistance. You can ask them to update the certificate bundle that your current WordPress installation is using, since it is most likely out of date.

2) Alternatively, you can disable SSL verification. Since version 6.0.3.1 of Easy forms for Mailchimp by YIKES we’ve included a custom action hook for users who are facing this issue.

Important: The following fix requires Easy Forms for Mailchimp by YIKES v6.0.3.1 or later.

Add the following snippet of code to the bottom of your functions.php file:

/* * Disable SSL Verify Host/SSL Verify Peer on CURL requests * only effects for Easy Forms for Mailchimp by YIKES */ function yikes_mailchimp_disable_ssl_verfiy_host_and_peer( $ch ) { curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); } add_action( 'yikes-mailchimp-api-curl-request', 'yikes_mailchimp_disable_ssl_verfiy_host_and_peer' );

Please Read:

If you are on a live server, and the above did not help resolve the issue – the only other option is to reach out to your hosting provider. This is not something we are able to resolve, as it lies at the server level.

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 I fix 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 add SSL to curl?

Following these steps should help you:.
Download and save the self-signed certificate..
Tell the Curl client about it with --cacert [file] command-line switch. This parameter tells the Curl to use the specified certificate file to verify the peer. The [file] may contain multiple CA certificates and must be in PEM format..