skip to Main Content

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:

  • Update 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

  • Rerun the Composer installer

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

2

Answers


  1. Chosen as BEST ANSWER

    Finally managed to solve it by manually replacing the ca-bundle.crt file, after realizing that even a simple curl/wget CLI command (outside of PHP/Composer) returned the same error (this the reason of the --no-check-certificate below):

    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


  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search