SSL certificate problem: unable to get issuer certificate

SSL certificate problem: unable to get issuer certificate

  1. Blog
  2. 15 November 2026
  3. 4 min read

Stefan Bogdanescu

Founder & Senior Architect

SSL certificate problem: unable to get issuer certificate

You are encountering a classic OpenSSL chain validation failure, but the root cause isn't necessarily what the error message implies. The specific error SSL certificate problem: unable to get issuer certificate indicates that your PHP application successfully connected to the server and retrieved the leaf certificate (the one issued to my.website.com). However, it failed to construct a complete trust chain back to a trusted root authority.

In your debug output, you see:

> * CAfile: C:\Development\examples\COMODORSADomainValidationSecureServerCA.pem  
> CApath: none

This confirms that curl (and the underlying OpenSSL library used by PHP) is looking for a Certificate Authority bundle at that specific path. The issue arises when the intermediate certificates required to bridge the gap between your leaf certificate and the root are missing or mismatched in that file.

Why Adding a Root Certificate Often Fails

The most common mistake developers make here is downloading only the root certificate (e.g., COMODORSADomainValidationSecureServerCA.crt) and placing it in php.ini. While this adds a trusted root to your store, it does not automatically include the intermediate certificates.

SSL/TLS chains work hierarchically: Root CA -> Intermediate CA -> Leaf Certificate. When you connect to a server, it sends its leaf certificate along with any necessary intermediate certificates to prove that chain of trust. If the server sends the intermediate but your local CAfile only contains the root, OpenSSL can verify the signature of the intermediate against the root, but it might still struggle if the specific intermediate version in the bundle doesn't perfectly match the one the server is serving at that moment, or if the bundle lacks the necessary intermediates entirely.

Your log shows you are using a file named COMODORSADomainValidationSecureServerCA.pem. Based on standard naming conventions for Comodo (now Sectigo) roots, this is almost certainly just the root certificate. The server might be presenting an intermediate certificate that is not present in your local bundle, causing OpenSSL to stop at "unable to get issuer certificate" because it cannot validate the link between the server's cert and your root store.

The Correct Fix: Using a Full Bundle

The solution you attempted earlier—downloading the full CA bundle from https://curl.haxx.se/docs/caextract.html—is actually the correct approach, yet it seems to have failed in your environment. This tool provides a comprehensive list of current roots and intermediates used by major browsers and curl.

If adding that file to php.ini didn't work, check two specific areas:

  1. File Format and Encoding: Ensure the downloaded bundle is valid PEM format (text-based with lines starting with -----BEGIN CERTIFICATE-----). Sometimes older converters or specific downloads might produce binary DER files masquerading as text.
  2. php.ini Configuration Syntax: Verify that your php.ini actually points to this file. Look for a line like:
    curl.cainfo = "C:\Development\examples\ca-bundle.crt"
    
    Note the syntax. In older versions of PHP, you might use openssl.cafile. However, modern PHP (7.4+) and the curl extension handle this via CURLOPT_CAINFO or the specific curl.cainfo directive if using the underlying libcurl logic. Ensure there are no typos in the path, especially on Windows where backslashes need to be escaped (\\) or quoted properly.

Alternative: Using System Trust Stores

If you cannot get a specific CA bundle to work, another robust method is to instruct PHP/Openssl to trust your operating system's default store. On Windows, this often requires ensuring the openssl extension is configured to look for certificates in the OS-specific locations or explicitly pointing it there. However, since you are testing on a local machine, relying on a curated bundle from curl.haxx.se is usually safer and more portable than navigating OS-specific registry keys or cert stores which can vary between machines.

Disabling Verification (Not Recommended)

Your script currently allows you to bypass this check:

// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

While uncommenting these lines makes the request succeed, it completely disables security. If an attacker intercepts your traffic (Man-in-the-Middle), they could present a fake certificate, and your script would accept it because you told OpenSSL to ignore verification. This is critical for production environments but acceptable only for controlled local testing where network isolation is guaranteed.

Final Recommendation

To resolve this without disabling security:

  1. Download the latest cacert.pem from https://curl.haxx.se/ca/cacert.pem.
  2. Place it in a directory accessible to your PHP CLI.
  3. Update your php.ini or use a -d command line argument when running your script:
    php -d curl.cainfo="C:\path\to\cacert.pem" your_script.php
    
  4. Ensure the file contains both the root and the relevant intermediate certificates. The cacert.pem from Curl's official source is updated frequently to include new intermediates, which is likely why the older or manually downloaded root certificate failed in your initial attempts.

Our network