Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run composer update due to Connection timed out #4247

Closed
mrbinr opened this issue Jul 12, 2015 · 28 comments
Closed

Unable to run composer update due to Connection timed out #4247

mrbinr opened this issue Jul 12, 2015 · 28 comments
Labels

Comments

@mrbinr
Copy link

mrbinr commented Jul 12, 2015

Hi
Since last friday i'm trying to use composer and i always have a Connection timed out problem ...
I was looking for some answer with gg or here on github but without result ... :(
When i run :
curl -sS https://getcomposer.org/installer | php
i have this reponse :

!/usr/bin/env php

All settings correct for using Composer
Downloading...
Download failed: file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: Connection timed out
Downloading...
Download failed: file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: Connection timed out
Downloading...
Download failed: file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: Connection timed out
The download failed repeatedly, aborting.

As mentionned in some post i have downloaded cacert.pem and run commane
curl -sS https://getcomposer.org/installer | php -- --cafile=cacert.pem
but i get same answer as above

Here is composer diagnose :
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity: FAIL
[Composer\Downloader\TransportException] The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Connection timed out
Checking github.com rate limit: FAIL
[Composer\Downloader\TransportException] The "https://api.github.com/rate_limit" file could not be downloaded: SSL: Handshake timed out
Failed to enable crypto
failed to open stream: operation failed
Checking disk free space: OK
Checking composer version:

[Composer\Downloader\TransportException]
The "https://getcomposer.org/version" file could not be downloaded: failed to open stream: Connection timed out

I've seem i'm not the only one with problem with composer since some days k0pernikus posted an issue #4212 with similar problem

I really don't know what to do ...
Thanks for your help

Best Regards
Pascall

diagnose

@mrbinr
Copy link
Author

mrbinr commented Jul 12, 2015

additional information i'm using PHP 5.6.7-1 on Debian GNU/Linux 7 (wheezy)

@mrbinr
Copy link
Author

mrbinr commented Jul 12, 2015

ok ... i have modified my php.ini by adding lines :
curl.cainfo=/path/to/ssl-certs/ca-bundle.crt
openssl.cafile=/path/to/ssl-certs/ca-bundle.crt

and now i have this error :

PHP Notice: Undefined variable: caBundle in - on line 821

@mrbinr
Copy link
Author

mrbinr commented Jul 12, 2015

on line 821 there is :
if ($configured && strlen($configured) > 0 && is_readable($caBundle) && validateCaFile(file_get_contents($caBundle))) {

and $caBundle is not defined i think i must be changed to :

if ($configured && strlen($configured) > 0 && is_readable($configured) && validateCaFile(file_get_contents($configured))) {

this solve one problem, but not the first one

@mrbinr
Copy link
Author

mrbinr commented Jul 12, 2015

when i run wget command to get composer.phar :
wget https://getcomposer.org/composer.phar
--2015-07-12 10:01:08-- https://getcomposer.org/composer.phar
Résolution de getcomposer.org (getcomposer.org)... 2001:41d0:a:7b19::, 87.98.253.108
Connexion vers getcomposer.org (getcomposer.org)|2001:41d0:a:7b19::|:443...échec: Connexion terminée par expiration du délai d'attente.
Connexion vers getcomposer.org (getcomposer.org)|87.98.253.108|:443...connecté.
requête HTTP transmise, en attente de la réponse...200 OK
Longueur: 1113024 (1,1M) [application/octet-stream]
Sauvegarde en : «composer.phar»

100%[====================================================================================================================>] 1 113 024 408K/s ds 2,7s

2015-07-12 10:02:18 (408 KB/s) - «composer.phar» sauvegardé [1113024/1113024]

it seems to have problem with ipV6 ?

@Seldaek
Copy link
Member

Seldaek commented Jul 12, 2015

We enabled ipv6 recently, if you have problems please contact your ISP (I guess you're on free.fr? A few people already reported issues there, but I am not sure if anyone contacted free yet). Let them know which domain/IP you are trying to reach and maybe provide them with a traceroute6 output to see where it breaks down.

@mrbinr
Copy link
Author

mrbinr commented Jul 12, 2015

Hi,
yes my ISP is free.fr ... :( i don't know if contacting them may help us to find solution ...

@mrbinr
Copy link
Author

mrbinr commented Jul 12, 2015

It seems that something changes :

wget https://getcomposer.org/composer.phar
--2015-07-12 19:19:09-- https://getcomposer.org/composer.phar
Résolution de getcomposer.org (getcomposer.org)... 2001:41d0:a:7b19::, 87.98.253.108
Connexion vers getcomposer.org (getcomposer.org)|2001:41d0:a:7b19::|:443...connecté.
requête HTTP transmise, en attente de la réponse...200 OK
Longueur: 1113632 (1,1M) [application/octet-stream]
Sauvegarde en : «composer.phar»

100%[====================================================================================================================>] 1 113 632 65,6K/s ds 12s

2015-07-12 19:19:26 (87,5 KB/s) - «composer.phar» sauvegardé [1113632/1113632]

IPV6 seems to work now ...

@mrbinr
Copy link
Author

mrbinr commented Jul 12, 2015

humm .. but composer problem is not solved :

#!/usr/bin/env php
All settings correct for using Composer
Downloading...
Download failed: file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: Connection timed out
Downloading...
Download failed: file_get_contents(): SSL: Handshake timed out
file_get_contents(): Failed to enable crypto
file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: operation failed
Downloading...
Download failed: file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: Connection timed out
The download failed repeatedly, aborting.

@mrbinr
Copy link
Author

mrbinr commented Jul 12, 2015

I've tried wget again ... and now it doesn't work as this morning :

--2015-07-12 19:40:09-- https://getcomposer.org/composer.phar
Résolution de getcomposer.org (getcomposer.org)... 2001:41d0:a:7b19::, 87.98.253.108
Connexion vers getcomposer.org (getcomposer.org)|2001:41d0:a:7b19::|:443...échec: Connexion terminée par expiration du délai d'attente.
Connexion vers getcomposer.org (getcomposer.org)|87.98.253.108|:443...connecté.
requête HTTP transmise, en attente de la réponse...200 OK
Longueur: 1113632 (1,1M) [application/octet-stream]
Sauvegarde en : «composer.phar.4»

100%[====================================================================================================================>] 1 113 632 68,8K/s ds 13s

2015-07-12 19:41:28 (84,6 KB/s) - «composer.phar.4» sauvegardé [1113632/1113632]

@mrbinr
Copy link
Author

mrbinr commented Jul 12, 2015

Is there a solution to continue using ipv4 instead of ipv6 , cause now i can't continue my work ... :(

@mrbinr
Copy link
Author

mrbinr commented Jul 12, 2015

I have disable IP v6 on my computer

#disable ipv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.eth0.disable_ipv6 = 1

wget works with ipv4

wget https://getcomposer.org/composer.phar
--2015-07-12 20:07:19-- https://getcomposer.org/composer.phar
Résolution de getcomposer.org (getcomposer.org)... 87.98.253.108, 2001:41d0:a:7b19::
Connexion vers getcomposer.org (getcomposer.org)|87.98.253.108|:443...connecté.
requête HTTP transmise, en attente de la réponse...200 OK
Longueur: 1113632 (1,1M) [application/octet-stream]
Sauvegarde en : «composer.phar.5»

100%[====================================================================================================================>] 1 113 632 69,4K/s ds 17s

2015-07-12 20:07:39 (64,6 KB/s) - «composer.phar.5» sauvegardé [1113632/1113632]

but i still have problem with composer using curl

curl -sS https://getcomposer.org/installer | php
#!/usr/bin/env php
All settings correct for using Composer
PHP Notice: Undefined variable: caBundle in - on line 821
Downloading...
Download failed: file_get_contents(): SSL: Handshake timed out
file_get_contents(): Failed to enable crypto
file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: operation failed
Downloading...
Download failed: file_get_contents(): SSL: Handshake timed out
file_get_contents(): Failed to enable crypto
file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: operation failed
Downloading...
Download failed: file_get_contents(): SSL: Handshake timed out
file_get_contents(): Failed to enable crypto
file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: operation failed
The download failed repeatedly, aborting.

@mrbinr
Copy link
Author

mrbinr commented Jul 12, 2015

using composer.phar downloaded with wget give me error :

[Composer\Downloader\TransportException]
The "https://packagist.org/packages.json" file could not be downloaded: SSL: Handshake timed out
Failed to enable crypto
failed to open stream: operation failed

@mrbinr
Copy link
Author

mrbinr commented Jul 12, 2015

here is php composer.phar diag :

Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: FAIL
[Composer\Downloader\TransportException] The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Connection timed out
Checking github.com rate limit: FAIL
[Composer\Downloader\TransportException] The "https://api.github.com/rate_limit" file could not be downloaded: SSL: Handshake timed out
Failed to enable crypto
failed to open stream: operation failed
Checking disk free space: OK
Checking composer version:

[Composer\Downloader\TransportException]
The "https://getcomposer.org/version" file could not be downloaded: SSL: Handshake timed out
Failed to enable crypto
failed to open stream: operation failed

@mrbinr
Copy link
Author

mrbinr commented Jul 12, 2015

Ok so after hours of investigation i've seen that bind9 was not install on my computer ... why ? i don't know .. but after having reinstall it composer diag works ...

php composer.phar diag :

Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking composer version: OK

composer self-update and composer update too ... but it's really really slow .. (composer update hasn't finished yet ... )

@mrbinr
Copy link
Author

mrbinr commented Jul 21, 2015

hi,
my problem with composer is not solved ... now i can launch it but it is very very very ... slow ... and i really donc know where is the problem.

I have talk about it on free.fr user forum, but without any answer ...

@alcohol
Copy link
Member

alcohol commented Jul 21, 2015

You can try forcing ipv4 connectivity. But if it is really slow over ipv6 that would indicate issues with your ISP.

@sytlos
Copy link

sytlos commented Jul 24, 2015

I have the same problem when i run a composer diag (Debian 7.8)

Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: FAIL
[Composer\Downloader\TransportException] The "https://api.github.com/rate_limit" file could not be downloaded: failed to open stream: Connection timed out
Checking disk free space: OK
Checking composer version: OK

@alcohol
Copy link
Member

alcohol commented Jul 24, 2015

That does not look to be the same problem. You have trouble connecting to github.com, while you have no trouble connecting to packagist.org.

@sytlos
Copy link

sytlos commented Jul 24, 2015

Okay, i opened a new issue here
#4292

I must say that ssh -T git@github.com successfully authenticate me on github.
Maybe can you help me ?

@ghost
Copy link

ghost commented Nov 14, 2015

locate cacert.pem

vi /usr/local/lib/php.ini

#add this

openssl.cafile=/usr/local/share/perl5/Mozilla/CA/cacert.pem

press esc then type

:wq #enter

curl -sS https://getcomposer.org/installer | php -- —version=1.0.0-alpha10

mv composer.phar /usr/local/bin/composer

alias composer='/usr/local/bin/composer'

composer -V

php /usr/local/bin/composer global self-update

cd .composer/
composer init

@Seldaek Seldaek closed this as completed Mar 2, 2016
@calamarino
Copy link

Just in case it helps someone
https://getcomposer.org/doc/articles/troubleshooting.md#operation-timed-out-ipv6-issues-
Workaround Linux
sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"

@zawzawzaw
Copy link

Thanks a lot calamarino! I been googling for answer to that question for a long while.. thank god that i read your comment!

@alcohol
Copy link
Member

alcohol commented Sep 6, 2016

@zawzawzaw and you never considered reading our documentation (which contains exactly that answer)? Any reason why? Is the documentation hard to find? Not easy to navigate? Is the lack of a search functionality severely hindering its use? (honest questions)

@zawzawzaw
Copy link

@alcohol well if I knew documentation has those fixes for common problems I would have go there straight. But normally I use documentation while I am coding on new platform or framework. Never consider documentation as problem solving site like stackoverflow anyway I guess you know what I mean. But while I am googling about it there was no match result to documentation site though.

@alcohol
Copy link
Member

alcohol commented Sep 7, 2016

Maybe the documentation regarding this needs more context. That might help aid Google results. Unfortunately, it is difficult to determine how much context it might need and what would be considered relevant and what not. Thanks for the answer regardless :-)

@ionuttocila
Copy link

ionuttocila commented Jun 3, 2017

https://getcomposer.org/doc/articles/troubleshooting.md

Here you can find the workaround for some issues, disabling IpV6 worked for me just fine, please take a look at documentation.

@lankasenanayaka
Copy link

Thanks @calamarino it worked

@psarankeylent
Copy link

sudo ufw allow ssh
sudo ufw enable
sudo service php{version-number}-fpm restart
sudo service php8.1-fpm restart
sudo service apache2 restart

These cmd was helpfull for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants