Home  >  Article  >  Backend Development  >  How to Resolve PHP cURL Error Code 60: SSL Certificate Problem?

How to Resolve PHP cURL Error Code 60: SSL Certificate Problem?

Barbara Streisand
Barbara StreisandOriginal
2024-10-24 11:51:29634browse

How to Resolve PHP cURL Error Code 60: SSL Certificate Problem?

PHP cURL Error Code 60: SSL Certificate Problem

While configuring a PHP environment on Windows using WAMP, you may encounter error code 60 when using the Amazon PHP SDK:

<code class="php">Fatal error: Uncaught exception 'cURL_Exception' with message 'cURL resource: Resource id #10; cURL error: SSL certificate problem: unable to get local issuer certificate (cURL error code 60). See http://curl.haxx.se/libcurl/c/libcurl-errors.html for an explanation of error codes.' in...</code>

Cause:

This error occurs due to an issue with the SSL certificate used for verifying the remote endpoint.

Troubleshooting:

1. Verify your php.ini Settings:

Ensure that you have added the correct CA bundle file to your php.ini file:

curl.cainfo = C:\Windows\ca-bundle.crt

If the CA bundle doesn't exist or is invalid, cURL will be unable to verify the SSL certificate.

2. Use the curl.cainfo Setting Correctly:

The curl.cainfo setting should point to the path of the CA bundle. Typically, it's a PEM-encoded file containing multiple certificates.

3. Download the Trusted Root Certificate Bundle:

Use the trusted root certificate bundle from the following URL:

https://curl.haxx.se/ca/cacert.pem

4. Update the php.ini Setting:

Once you have downloaded the certificate bundle, update your php.ini file with the correct path:

curl.cainfo = "path_to_cert\cacert.pem"

5. Restart WAMP:

After updating the php.ini settings, restart the WAMP service for the changes to take effect.

The above is the detailed content of How to Resolve PHP cURL Error Code 60: SSL Certificate Problem?. 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