skip to Main Content

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"

[ComposerDownloaderTransportException] 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.

3

Answers


  1. Chosen as BEST ANSWER

    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.


  2. I had the same problem as you: downloading the cert and updating the php.ini values didn’t work.

    I simply upgraded all my server packages sudo apt-get update && sudo apt-get upgrade and the problem was solved. I haven’t pinpointed yet what the exact package/packages need to be updated though.

    Login or Signup to reply.
  3. Firewall, proxy or general networking related. Retry

    enter image description here

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