Home >Backend Development >PHP Tutorial >How to Fix 'Unable to get local issuer certificate' Errors in PHP Curl?

How to Fix 'Unable to get local issuer certificate' Errors in PHP Curl?

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-12-20 08:09:13621browse

How to Fix

Troubleshooting PHP Curl SSL Certificate Errors

Question:

When attempting to utilize PHP's Mandrill API, you encounter an SSL-related error: "Unable to get local issuer certificate." Despite implementing suggested solutions like adding curl.cainfo to php.ini, the issue persists.

Answer:

To resolve this error, follow these detailed instructions:

  1. Acquire Certificate Bundle: Download the certificate bundle from [curl.haxx.se](http://curl.haxx.se/docs/caextract.html).
  2. Place Certificate: Save the certificate in an accessible location, such as c:wamp or c:wamp64.
  3. Enable Necessary Modules: Ensure that mod_ssl is enabled in Apache and php_openssl.dll is uncommented in both php.ini files - one accessible via the WAMP taskbar icon and the other usually located at C:wampbinphpphp5.5.12.
  4. Set Openssl Path: Add the following lines to both php.ini files, replacing the paths with the actual location of the certificate bundle:
curl.cainfo="C:/wamp/cacert.pem"
openssl.cafile="C:/wamp/cacert.pem"
  1. Restart Services: Restart all services to initiate the changes.

By following these steps, you can effectively resolve SSL certificate errors and ensure uninterrupted operation of PHP curl-based applications.

The above is the detailed content of How to Fix 'Unable to get local issuer certificate' Errors in PHP Curl?. 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