packagist: SSL certificate problem: unable to get local issuer certificate

This error relates #972

I’ve been running composer fine for many months and years and then just recently I’m getting errors on composer outdated but it’s the same with any composer command

https://repo.packagist.org could not be fully loaded (curl error 60 while downloading https://repo.packagist.org/packages.json: SSL certificate problem: unable to get local issuer certificate), package information was loaded from the local cache and may be out of date
Legend:
! patch or minor release available - update recommended
~ major release available - update possible
markbaker/complex         2.0.3   ~ 3.0.1   PHP Class for working with complex numbers
markbaker/matrix          2.1.3   ~ 3.0.0   PHP Class for working with matrices
monolog/monolog           2.3.2   ! 2.3.4   Sends your logs to files, sockets, inboxes, databases and various web services
symfony/polyfill-mbstring v1.23.0 ! v1.23.1 Symfony polyfill for the Mbstring extension

Here’s the output from composer diagnose

Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: FAIL
[Composer\Downloader\TransportException] curl error 60 while downloading https://repo.packagist.org/packages.json: SSL certificate problem: unable to get local issuer certificate
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys: 
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: FAIL
[Composer\Downloader\TransportException] curl error 60 while downloading https://getcomposer.org/versions: SSL certificate problem: unable to get local issuer certificate
Composer version: 2.1.11
PHP version: 7.4.12
PHP binary path: /Applications/MAMP/bin/php/php7.4.12/bin/php
OpenSSL version: OpenSSL 1.0.2u  20 Dec 2019
cURL version: 7.68.0 libz 1.2.11 ssl OpenSSL/1.0.2u
zip: extension present, unzip present, 7-Zip not available

Any ideas?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 24 (4 by maintainers)

Most upvoted comments

OK so it is using /private/etc/ssl/cert.pem as CA bundle. Maybe that file is outdated? You could try to replace it with the latest from https://curl.se/docs/caextract.html ?

Ideally this should be updated automatically though…

If you use Avast, you don’t actually need to disable all shields, just uncheck the box Enable HTTPS scanning. That action solved the issue for me.

Avast Setup

i tried disabling avast and everything worked fine

Hmm. I don’t know why my cert.pem wasn’t being updated but it was dated 2017. I am running on High Sierra which is rather old I admit.

Anyway, backing up the old file and downloading and replacing it with the most from from your link above fixed the problem. Thank you very much.

Since I see this still gets comments I’ll just note my experience - I ran into this today and was scratching my head for a while. Ran all the checks I could, tried disabling ssl/tls, nothing was working…even installed new pem file manually, was still getting “Unable to get local issuer certificate”

Turned out it was my antivirus (Avast, specifically). I disabled all shields in Avast for 10 minutes and composer worked properly afterwards. Figured I’d drop this note as a reminder for others who might come along - try disabling any antivirus/firewall/vpn setup temporarily too, as that could be the culprit.

Just guessing but this sounds and reads like your ca bundle could be outdated. Can you access https://repo.packagist.org/packages.json via browser or is curl https://repo.packagist.org/packages.json working? Are there outstanding system/package updates? You’re on Linux, right?

Share the output of composer diagnose -vvv please. There should be some “Checked CA file” or “Checked directory …” on top which may indicate which CA bundle is used, and perhaps where the error lies.