Home > Enterprise >  Ubuntu 22.04 LTS and Composer curl error 60 - SSL certificate problem: unable to get local issuer ce
Ubuntu 22.04 LTS and Composer curl error 60 - SSL certificate problem: unable to get local issuer ce

Time:06-15

Whenver I use simple commands (install/update) for a Composer-based projects or the "diagnose" command composer diagnose -vvv, I get the error:

"curl error 60 while downloading https://repo.packagist.org/packages.json: SSL certificate problem: unable to get local issuer certificate"

I already tried to:

  • Updated to the latest Ubuntu (22.04) and specifically used:
sudo apt install ca-certificates --reinstall
sudo update-ca-certificates -f
sudo mkdir -p /etc/pki/tls/certs
sudo ln -s /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-certificates.crt

And in facts the diagnose says, as expected:

Checked CA file /etc/pki/tls/certs/ca-bundle.crt: valid

Some more information that could be useful:

Composer version: 2.2.6
PHP version: 8.1.2
PHP binary path: /usr/bin/php8.1
OpenSSL version: OpenSSL 3.0.2 15 Mar 2022
cURL version: 7.81.0 libz 1.2.11 ssl OpenSSL/3.0.2

CodePudding user response:

Finally managed to solve it by manually replacing the ca-bundle.crt file:

sudo mv /etc/ssl/certs/ca-bundle.crt /etc/ssl/certs/ca-bundle.crt.backup
sudo wget -O /etc/ssl/ca-bundle.crt https://curl.se/ca/cacert.pem --no-check-certificate

I got the link from: https://curl.se/docs/caextract.html

CodePudding user response:

Re-run the composer installer. IIRC it ships with its own certificate store or at least has some fallback package.

For your operating system, use the standard update procedure.

  • Related