Search code examples
phplaravelgithubcurlcomposer-php

SSL Certificate Error While Downloading Packages from GitHub with cURL Body


I'm encountering an SSL certificate error while trying to download Laravel packages using Composer. Here’s the error message I receive:

SSL: no alternative certificate subject name matches target host name 'codeload.github.com'
Failed to download laravel/breeze from dist: curl error 60 while downloading https://codeload.github.com/laravel/breeze/legacy.zip
  • I'm using Composer to manage my Laravel project dependencies.
  • The issue arises during the syncing process of various Laravel packages, such as laravel/breeze, league/flysystem, and nette/schema.
  • The error occurs consistently for multiple packages.

Steps Taken :

  • Verified that the URLs in my configuration are correct.
  • Updated cURL and OpenSSL to their latest versions.
  • Attempted to disable SSL verification using the -k option, but this is not a recommended solution for production.

How can I fix this problem :

  • Has anyone experienced similar issues?
  • What steps can I take to resolve this SSL certificate validation problem?
  • Are there any best practices for handling SSL errors in Composer or cURL?

Any guidance or advice would be greatly appreciated!


Solution

  • It will be possible to fix it in two different ways.

    1. By Composer: Run the command in the terminal composer config -g secure-http false
    2. Or Manually update cacert.pem from composer directory

    After running 1st point you need to install the library and after that, you need to run again composer config -g secure-http true