Php

HTTPS and SSL3GETSERVERCERTIFICATEcertificate verify failed CA is OK

27 September 2026 · 8 min read

HTTPS and SSL3GETSERVERCERTIFICATEcertificate verify failed CA is OK

Encountering the dreaded SSL3_GET_SERVER_CERTIFICATE:certificate verify failed, CA is OK error can be a frustrating experience for developers and system administrators alike. This cryptic message typically surfaces when your application attempts to establish a secure connection using HTTPS, but the verification of the server’s SSL/TLS certificate fails. While the “CA is OK” portion suggests the Certificate Authority itself is trusted, the error indicates a problem with the specific certificate presented by the server or the way your system is configured to validate it. Troubleshooting this issue requires a systematic approach, involving checks on certificate validity, trust stores, and configuration settings. Understanding the underlying causes and implementing the correct solutions is crucial to ensure secure communication and maintain the integrity of your applications and data. This article provides a comprehensive guide to diagnosing and resolving this common SSL/TLS problem, ensuring your systems can securely connect via HTTPS.

Understanding SSL/TLS Certificate Verification

Secure Sockets Layer (SSL) and its successor, Transport Layer Security (TLS), are cryptographic protocols designed to provide secure communication over a network. The core of this security relies on digital certificates, which act as electronic passports, verifying the identity of a server or client. During the HTTPS handshake, the client receives the server’s certificate and attempts to verify its authenticity. This verification process involves several checks, including ensuring the certificate is issued by a trusted Certificate Authority (CA), the certificate hasn’t expired, and the hostname in the certificate matches the domain being accessed.

The “SSL3_GET_SERVER_CERTIFICATE:certificate verify failed” error arises when one or more of these checks fail. Even if the root CA is trusted (“CA is OK”), the specific certificate presented by the server might be invalid, improperly configured, or not trusted by the client’s system. Common causes include self-signed certificates (which are not trusted by default), intermediate certificates missing from the server’s configuration, or a mismatch between the hostname and the certificate’s Subject Alternative Name (SAN) field. Correctly configuring your server to present a complete and valid certificate chain is essential for establishing a secure connection and avoiding this error. According to a study by the Ponemon Institute, misconfigured SSL/TLS certificates are a significant factor in data breaches, highlighting the importance of proper certificate management. Entrust offers insights on certificate management and the Ponemon Institute’s findings.

A key element of successful HTTPS connections is the client’s trust store. This trust store contains a list of trusted CAs. When the client receives a certificate, it traces back the chain of trust to a root CA in its trust store. If the certificate is issued by a CA not present in the trust store, or if any intermediate certificates are missing, the verification process will fail, leading to the “certificate verify failed” error. Ensuring your system has an up-to-date trust store is crucial.

Diagnosing the SSL3_GET_SERVER_CERTIFICATE Error

When faced with the “SSL3_GET_SERVER_CERTIFICATE:certificate verify failed, CA is OK” error, a systematic approach to diagnosis is crucial. Start by examining the server’s SSL/TLS certificate using online tools like SSL Labs’ SSL Server Test. These tools can identify common issues such as missing intermediate certificates, weak cipher suites, and certificate expiration. They provide a detailed analysis of the certificate chain and highlight any potential problems that could lead to verification failures. SSL Labs SSL Server Test is an excellent resource for this.

Next, verify that the hostname you are using to access the server matches the Common Name (CN) or Subject Alternative Name (SAN) fields in the certificate. If there is a mismatch, the verification will fail. This is a common problem when accessing a server using an internal IP address or a different domain name than the one specified in the certificate. Also, ensure that the client system’s clock is synchronized with a reliable time server. SSL/TLS certificates have validity periods, and if the client’s clock is significantly out of sync, the certificate may appear to be expired or not yet valid. This can also lead to verification failures.

Another important diagnostic step is to check the client’s trust store. On most operating systems, the trust store is a collection of CA certificates that the system trusts. You can use command-line tools like openssl to inspect the trust store and verify that the CA that issued the server’s certificate is present. If the CA is not in the trust store, you will need to add it manually. This is particularly important when dealing with self-signed certificates or certificates issued by private CAs.

Resolving the Certificate Verification Failure

The solution to the “SSL3_GET_SERVER_CERTIFICATE:certificate verify failed, CA is OK” error depends on the specific cause of the failure. Here are some common solutions:

  • Install Missing Intermediate Certificates: If the server is not sending the complete certificate chain, the client will be unable to verify the certificate. Ensure that the server’s configuration includes all necessary intermediate certificates. These certificates are typically provided by the CA that issued the server’s certificate.
  • Update the Client’s Trust Store: If the CA that issued the server’s certificate is not present in the client’s trust store, you will need to add it. This can be done manually using command-line tools or by importing the CA certificate into the system’s trust store management tool.
  • Correct Hostname Mismatch: Ensure that the hostname you are using to access the server matches the CN or SAN fields in the certificate. If necessary, update the hostname in your application or configuration file.

Here’s how to install missing intermediate certificates on an Apache web server:

  1. Obtain the intermediate certificate(s) from your Certificate Authority. These are usually provided as a .crt or .pem file.
  2. Copy the intermediate certificate file(s) to your server. A common location is /etc/ssl/certs/.
  3. Edit your Apache virtual host configuration file. This file is typically located in /etc/apache2/sites-available/.
  4. Find the SSLCertificateFile directive, which specifies the path to your server’s certificate.
  5. Add a new directive, SSLCertificateChainFile, specifying the path to the intermediate certificate file. If you have multiple intermediate certificates, concatenate them into a single file.
  6. Restart the Apache web server to apply the changes. Use the command sudo systemctl restart apache2.

For example, the featured snippet-optimized paragraph to resolve the error, you’d configure your server to include all intermediate certificates. This involves obtaining the intermediate certificate from your CA and adding it to your server’s SSL configuration, typically by concatenating it with your primary certificate file or specifying it in a separate SSLCertificateChainFile directive in your web server’s configuration. This ensures the client receives the complete chain of trust, enabling successful verification.

Best Practices for SSL/TLS Certificate Management

Preventing SSL/TLS certificate issues requires proactive management and adherence to best practices. Regularly monitor your certificates for expiration dates and renew them well in advance to avoid service disruptions. Use automated tools for certificate management to streamline the renewal process and ensure consistency. Consider using a Certificate Authority Authorization (CAA) record in your DNS settings to restrict which CAs are allowed to issue certificates for your domain. This helps prevent unauthorized certificate issuance and reduces the risk of man-in-the-middle attacks. According to Google, implementing CAA records can significantly enhance the security of your domain. Google’s security blog has more information on CAA records.

Implement a robust certificate monitoring system to track the status of your certificates and receive alerts when they are nearing expiration or have other issues. This allows you to take proactive steps to address potential problems before they impact your users. Regularly audit your SSL/TLS configuration to ensure it is up-to-date with the latest security best practices. Use tools like SSL Labs’ SSL Server Test to identify vulnerabilities and misconfigurations. Properly securing your HTTPS connections is an ongoing process. Staying informed about the latest threats and best practices is essential for maintaining a secure online presence.

  • Regularly monitor certificate expiration dates.
  • Use automated tools for certificate management.
Infographic here: Diagram of SSL/TLS Handshake with emphasis on Certificate Verification
FAQ: Common Questions About SSL3\_GET\_SERVER\_CERTIFICATE ----------------------------------------------------------
What does "CA is OK" mean in the error message?
It indicates that the client trusts the root Certificate Authority that issued the server's certificate. The problem lies elsewhere, such as a missing intermediate certificate or a hostname mismatch.
How do I find the missing intermediate certificates?
Your Certificate Authority typically provides the intermediate certificates along with the server certificate. Check their website or documentation.
Can I ignore this error if I'm using a self-signed certificate?
You should not ignore it. While self-signed certificates can be used for testing, they are not trusted by default and should not be used in production environments. You will need to manually add the self-signed certificate to your client's trust store, which is generally not recommended for security reasons.
Resolving the "SSL3\_GET\_SERVER\_CERTIFICATE:certificate verify failed, CA is OK" error requires a clear understanding of SSL/TLS certificate verification and a systematic approach to diagnosis and troubleshooting. By following the steps outlined in this article, you can identify the root cause of the problem and implement the appropriate solution. Remember that proper certificate management and adherence to best practices are essential for maintaining a secure online presence. Keep your systems secure by regularly updating trust stores, installing missing intermediate certificates, and ensuring hostname matches. If you're looking for further resources, explore [our related articles on network security](https://courthousezoological.com/n7sqp6kh?key=e6dd02bc5dbf461b97a9da08df84d31c).

Question & Answer :
I am using XAMPP for development. Recently I upgraded my installation of xampp from an old version to 1.7.3.

Now when I curl HTTPS enabled sites I get the following exception

Fatal error: Uncaught exception ‘RequestCore_Exception’ with message ‘cURL resource: Resource id #55; cURL error: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed (60)’

Everyone suggest using some specific curl options from PHP code to fix this problem. I think this shouldn’t be the way. Because I didn’t have any problem with my old version of XAMPP and happened only after installing the new version.

I need help to figure out what settings change in my PHP installation, Apache etc can fix this problem.

It’s a pretty common problem in Windows. You need just to set cacert.pem to curl.cainfo.

Since PHP 5.3.7 you could do:

  1. download https://curl.se/ca/cacert.pem and save it somewhere.
  2. update php.ini – add curl.cainfo = “PATH_TO/cacert.pem”

Otherwise you will need to do the following for every cURL resource:

curl_setopt ($ch, CURLOPT_CAINFO, "PATH_TO/cacert.pem");