Workaround to Solve Composer Installation Timeout Error


This article provides a guide for how to use a workaround to solve Composer installation timeout error.

Background

While installing Composer, it's possible to get the following error message:

PHP Warning:  copy(https://getcomposer.org/installer): failed to open stream: Connection timed out in Command line code on line 1

Workaround to Solve Composer Installation Timeout Error

In this scenario, we recommend to run the following command as root (or equivalent) user:

sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"

Now reattempt your original installation command and you should now get the expected installation steps and confirmation.

Explanation of Issue

This error is related to IPv6 network configuration issues, compounded by the server's preference for IPv6 connection, causing the connection to fail.

By executing the above workaround, the server will default to IPv4 connection to the Composer repository.

  • composer, installation, workaround, ipv6
  • 0 Utenti hanno trovato utile questa risposta
Hai trovato utile questa risposta?

Related Articles

View Server PHP Environment with phpinfo.php

The phpinfo() function outputs a huge amount of information about the system you're using, such...

How to Create Sudo User on CentOS

This article provides step-by-step setup guide for adding Sudo user to CentOS system. The sudo...

How to Use Sudo

This article provides a guide to using a Sudo user on CentOS server. From the command line,...

Set Server Time Zones with Timedatectl

This article provides a guide to setting the server time and server time zone settings using...

508 Resource Limit is Reached

If your website is on a cPanel hosting account, you may have noticed the following error message:...