phpsslcomposer-phpcertificate

curl error 60 while downloading https://repo.packagist.org Certificate issue on Ubuntu?


I've installed composer globally (and locally - just for testing) according to https://getcomposer.org/download/

Then, I'm trying composer create-project laravel/laravel and I receive an error:

composer create-project laravel/laravel Creating a "laravel/laravel" project at "./laravel"

[Composer\Downloader\TransportException]
curl error 60 while downloading https://repo.packagist.org/packages.json: SSL: no alternative certificate subject name matches target host name 'repo.packagist.org'

So I've tried this one including the answer: https://stackoverflow.com/a/59339136/2110476

curl.cainfo = "/etc/ssl/certs/cacert.pem"
openssl.cafile = "/etc/ssl/certs/cacert.pem"
openssl.capath = "/etc/ssl/certs/cacert.pem"

into the 7.4 CLI php.ini: php --ini

Configuration File (php.ini) Path: /etc/php/7.4/cli
Loaded Configuration File: /etc/php/7.4/cli/php.ini
Scan for additional .ini files in: /etc/php/7.4/cli/conf.d
Additional .ini files parsed: /etc/php/7.4/cli/conf.d/10-mysqlnd.ini,
...

which seems to be fine? php -i | grep -i openssl

SSL Version => OpenSSL/1.1.1f libSSH Version => libssh/0.9.3/openssl/zlib openssl OpenSSL support => enabled OpenSSL Library Version => OpenSSL 1.1.1f 31 Mar 2020 OpenSSL Header Version => OpenSSL 1.1.1f 31 Mar 2020 Openssl default config => /usr/lib/ssl/openssl.cnf openssl.cafile => /home/hpn/Software/cacert.pem => /home/hpn/Software/cacert.pem
openssl.capath => /home/hpn/Software/cacert.pem => /home/hpn/Software/cacert.pem
Native OpenSSL support => enabled

I've even gone so far and tried Composer Require 'package' throws OpenSSL error

composer config disable-tls true
composer config secure-http false

But the error still remains.

Then I've found this one: http://manpages.ubuntu.com/manpages/bionic/man8/update-ca-certificates.8.html and did: sudo update-ca-certificates - still with the same error.


Solution

  • I've had a static IP set in my /etc/hosts file. After I've commented that one out, things worked as expected.

    Sorry for the confusion - maybe it'll still help someone in the future.