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

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

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

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

When you attempt to scaffold a new Laravel project using composer create-project laravel/laravel, the process halts immediately if your environment cannot validate the SSL certificate of the Packagist repository. The specific error message, curl error 60 while downloading https://repo.packagist.org/packages.json: SSL: no alternative certificate subject name matches target host name 'repo.packagist.org', points directly to a mismatch between the hostname in the server's certificate and what your client expects to see.

This is not a Composer bug, nor is it typically a PHP configuration issue. The root cause lies in how Ubuntu handles its CA bundle or how specific system libraries resolve certificates during execution. When you run php -i | grep -i openssl, you might see openssl.cafile pointing to /home/hpn/Software/cacert.pem. If this path differs from the default location expected by the OpenSSL library on your system, or if that file lacks the necessary root certificates for repo.packagist.org, validation fails.

A common first step suggested in various forums involves manually editing the PHP configuration file to point to a known-good CA bundle. You can add these lines to your /etc/php/7.4/cli/php.ini:

curl.cainfo = "/etc/ssl/certs/cacert.pem"
openssl.cafile = "/etc/ssl/certs/cacert.pem"
openssl.capath = "/etc/ssl/certs/ca-certificates.crt"

However, this approach requires precision. If you define cafile as a single file, capath usually needs to point to the directory containing the .crt bundle or be omitted entirely if your OpenSSL build does not strictly require both. Simply copying a certificate file from one location to another without ensuring it contains the full chain of trust for the target hostname often results in the same error persisting.

Another frequent attempt involves disabling SSL verification entirely using Composer commands:

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

While this resolves connectivity issues, it is a significant security trade-off. Disabling TLS verification means Composer will accept any certificate, including self-signed ones or those issued by untrusted CAs. This exposes your project to Man-in-the-Middle (MitM) attacks, where an attacker could intercept package requests and inject malicious code into your vendor folder. In a production environment, this configuration is strictly discouraged unless you are in a highly controlled, air-gapped network with verified internal CA certificates.

If the manual configuration changes do not resolve the issue, the problem likely stems from the system's CA bundle itself being outdated or corrupted. Ubuntu provides a utility to refresh these certificates automatically:

sudo update-ca-certificates

This command scans /usr/share/ca-certificates/mozilla/ and regenerates /etc/ssl/certs/ca-certificates.crt. If this file is missing the root certificate for DigiCert (which often issues certificates for Packagist), validation will fail until the bundle is updated. Running sudo update-ca-certificates ensures that your system trusts the current set of public CAs.

Sometimes, the issue is not with the PHP configuration but with the underlying curl binary used by Composer. If php-curl is installed but relies on a different CA bundle than the system default, or if the curl library itself has an outdated certificate store, you may need to regenerate the curl CA bundle:

sudo /etc/ssl/certs/ssl-cert-generator-wrapper
# Or simply ensuring the standard update command ran successfully

After refreshing the certificates and verifying that /etc/ssl/certs/ca-certificates.crt exists and is up to date, restart your PHP CLI or ensure you are using the correct version. In some cases, switching to a newer version of PHP (e.g., 8.1+) might also help, as older versions like 7.4 on Ubuntu Bionic may have stricter or differently configured SSL defaults that conflict with modern certificate authorities.

If you are working in a corporate environment where you cannot update system packages or use external CAs, the only viable option is to install your organization's internal CA certificates into /etc/ssl/certs/ and ensure they are included in the bundle used by OpenSSL. However, for standard development on Ubuntu, ensuring sudo update-ca-certificates has run recently is usually sufficient to resolve the hostname mismatch error without compromising security.

Our network