I have faced an issue with a Laravel backend which is trying to make an HTTPS request to another service, and by checking the logs I have found this error.
[2021-05-20 02:16:53] production.ERROR: cURL error 77: error setting certificate verify locations: CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) {"exception":"[object] (GuzzleHttp\\Exception\\RequestException(code: 0): cURL error 77: error setting certificate verify locations: CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) at /www/wwwroot/backend/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:201) [stacktrace]
I’m using Ubuntu server 20.04.2 LTS with PHP 7.1 installed.
And here you are what I made to solve the issue.
sudo apt-get install ca-certificates
This package includes PEM files of CA certificates to allow SSL-based applications to check for the authenticity of SSL connections.
sudo mkdir -p /etc/pki/tls/certs
This will create folders for the target destination if they do not exist.
sudo cp /etc/ssl/certs/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt
Finally, copy certificate to the expected destination.