Home >Backend Development >PHP Tutorial >PHP SSL Error: How to Fix 'Unable to Get Local Issuer Certificate' When Using the Mandrill API?

PHP SSL Error: How to Fix 'Unable to Get Local Issuer Certificate' When Using the Mandrill API?

Patricia Arquette
Patricia ArquetteOriginal
2024-12-19 05:27:44152browse

PHP SSL Error: How to Fix

PHP SSL Certificate Error: Resolving the "Unable to Get Local Issuer Certificate" Issue

When endeavoring to leverage the Mandrill API, PHP developers may encounter an error stating "API call to messages/send-template failed: SSL certificate problem: unable to get local issuer certificate." This article aims to provide guidance in resolving this issue.

The first step is to ensure that the PHP configuration specifies the location of the certificate authority (CA) certificate. Verify that the following lines are present in your php.ini file:

curl.cainfo = "C:\xampp\php\cacert.pem"
openssl.cafile = "C:\xampp\php\cacert.pem"

If these entries are absent or incorrect, add them to your php.ini file and restart the Apache server. However, this solution alone may not resolve the issue.

As a comprehensive solution, follow these steps:

  1. Download the certificate bundle from http://curl.haxx.se/docs/caextract.html.
  2. Install the certificate bundle in a convenient location, such as "C:wamp" or "C:wamp64".
  3. Edit your php.ini files (both in your WAMP taskbar and potentially in "C:wampbinphpphp5.5.12"), ensuring that mod_ssl and php_openssl.dll are enabled.
  4. Add the following lines to both php.ini files:
curl.cainfo="C:/wamp/cacert.pem"
openssl.cafile="C:/wamp/cacert.pem"
  1. Restart your WAMP services.

After implementing these steps, the PHP application should no longer encounter the "unable to get local issuer certificate" error when utilizing the Mandrill API.

The above is the detailed content of PHP SSL Error: How to Fix 'Unable to Get Local Issuer Certificate' When Using the Mandrill API?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn