PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, December 31, 2021

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

 December 31, 2021     certificate, composer-php, php, ssl     No comments   

Issue

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.



Answered By - Chris
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing