Skip to content

Instantly share code, notes, and snippets.

@Luiyit
Last active August 1, 2023 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Luiyit/e75c827ca4f31f45cc67efa5a529c31c to your computer and use it in GitHub Desktop.
Save Luiyit/e75c827ca4f31f45cc67efa5a529c31c to your computer and use it in GitHub Desktop.
How to fix "SSL certificate problem" using curl on Windows

How to fix SSL certificate problem using curl on Windows

Confirm the issue

You can confir the issue checking the curl error $error = curl_error($curl) SHould say somathing like: SSL certificate problem: unable to get local issuer certificate

1. Download the lasted cacert.pem

you can download the file here

2. Fast test

To test it, configure the curl to use those certificates. Add this configuration curl_setopt($curl, CURLOPT_CAINFO, 'your/absolute/favorite/path/cacert.pem');

With it, the ssl issue should e fixed.

3. Config it globally

If you want, you can set a default value for CAINFO. TO do that, open your php.ini file, find the configuration curl.cainfo and uncomment and set the absolute path of you .pem file.

A good place to this file is inside the php folder, together to php.ini

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment