your web applications running on your local machine, such as for example Drupal running on Wampserver or XAMPP on your computer or laptop, might encounter some errors when trying to use cURL to access external resources through the internet.
here an example from Drupal:
the logs can show errors such as
cURL error 60: SSL certificate problem
cURL error 60: SSL certificate problem: unable to get local issuer certificate
GuzzleHttp\Exception\RequestException: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) in GuzzleHttp\Handler\CurlFactory::createRejection() (line 201 of C:\wamp64\www\drupal9-dev\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php).
Cause:
the connection uses SSL for security. but SSL needs to be configured with a certificate.
Solution:
1- download a certificate file here:
https://curl.haxx.se/docs/caextract.html
the file is named "cacert.pem"
umm... yeah. haxx in the URL doesn't look very trustworthy, but that's from the official cURL homepage, lol.
2- create a directory within your Wampserver directory. For example, C:\wamp64\certificates
3- move the downloaded file "cacert.pem" into that directory
4- go to your WAMP's PHP directory, on my machine it's at C:\wamp64\bin\php
you will see 2 or more subdirectories with the versions of the installed php versions
go into EACH of these directories and modify the php.ini files.
find ;curl.cainfo=
remove the semicolon and add the path to your cacert.pem file, so that the line reads:
curl.cainfo=C:\wamp64\certificates\cacert.pem
do this for all installed PHP versions.
WARNING ! CATCH 22:
Wampserver has another .ini file used by APACHE for PHP.
it's called phpForApache.ini and you will need to make the same changes to these files for your web application to work with cURL.
after changing the files, restart Apache if it was running.
- Log in to post comments
Comments