Home >Backend Development >PHP Tutorial >How to Fix 'certificate verify failed, CA is OK' HTTPS Errors in XAMPP 1.7.3?

How to Fix 'certificate verify failed, CA is OK' HTTPS Errors in XAMPP 1.7.3?

Patricia Arquette
Patricia ArquetteOriginal
2024-12-09 20:19:18710browse

How to Fix

HTTPS Connection Error: "certificate verify failed, CA is OK" on XAMPP 1.7.3

When attempting to make HTTPS connections using XAMPP 1.7.3, developers may encounter the following error:

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)'

This error typically arises when the server's SSL certificate can't be verified by the client using the default certificate authority (CA) certificate store. The suggested solution of setting curl options in PHP code is not ideal for a server-wide fix.

Instead, the solution lies in updating the configuration of the PHP and Apache installations on the system.

Fix for PHP 5.3.7 and Above:

  1. Download cacert.pem from https://curl.se/ca/cacert.pem and store it in an appropriate location.
  2. Update php.ini and add the line: curl.cainfo = "PATH_TO/cacert.pem"

Fix for PHP Versions Below 5.3.7:

For each cURL resource, manually set the CA certificate file using the following code:

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

Note: Ensure that the PATH_TO in both solutions points to the location of the downloaded cacert.pem file.

The above is the detailed content of How to Fix 'certificate verify failed, CA is OK' HTTPS Errors in XAMPP 1.7.3?. 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