Composer Install "Failed to open stream"
Asked Answered
T

2

3

Whenever I run the installer, or even manually installing Composer, I get an error that disallowed me to complete the installation and it is irritating. In Laragon, a program used to create many different projects using composer and its packages. It will not allow me to use Laravel because the Composer will not properly install and function.

The Error is:

The "https://getcomposer.org/versions" file could not be downloaded: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

The "https://getcomposer.org/download/1.4.2/composer.phar.sig" file could not be downloaded: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

Tonsil answered 20/7, 2017 at 20:59 Comment(14)
could you add output of "composer diagnose"? update: sorry I didnt noticed that you cant Install itFaires
are you using linux or windows?Faires
@RafailAkhmetshin I am using windows, the strange thing is I can use composer diagnose but composer isn't installing... I guess because I am Using Laragon which comes with composerTonsil
And does composer diagnose give you any warning about failed tests? could you check that url is accessible from php using hints from this answers #5764502 #8031289Faires
@RafailAkhmetshin It says the websites are dead. Also, I have the diagnose composer errors but I am not sure where to post it. I'm new to stackoverflow.Tonsil
@RafailAkhmetshin Nevermind, here you go: pastebin.com/NGk0YxKKTonsil
are you trying to do this in corporate network or at home? Could you try to connect to https url (important) using curl or something like it curl https://getcomposer.org/versions Also can you check that your openssl extension is enabled? in php.iniFaires
So, after a lot of time being frustrated (home network), I tried a VPN and it worked, so how can I do this without a VPN? @RafailAkhmetshinTonsil
I don't know. We need figure out what was blocked when you use home network. could you open https://getcomposer.org/versions using your browser or do you receive any king warnings about certificate?Faires
No warning, it shows this: { "stable": [{"path": "/download/1.4.2/composer.phar", "version": "1.4.2", "min-php": 50300}], "preview": [{"path": "/download/1.4.2/composer.phar", "version": "1.4.2", "min-php": 50300}], "snapshot": [{"path": "/composer.phar", "version": "189ba423aedc387a0487df40afc2428947406327", "min-php": 50300}] } @RafailAkhmetshinTonsil
Also, the curl getcomposer.org line works and produces the proper line. Although, curl -sS getcomposer.org/installer | php resulted in an error while downloading... The "getcomposer.org/versions" file could not be downloaded: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.Tonsil
So, I just tried install and use composer on my laptop and it worked, so it is something to do with my PC, that is weird, anything I should do to fix this? @RafailAkhmetshinTonsil
could you add output of this command php -i | grep " PHP Stream". also please check to this issue - looks very similar to yours github.com/composer/composer/issues/4888Faires
'grep' is not recognized as an internal or external command, operable program or batch file. I tried to clean my ipv6 but it didn't fix. @RafailAkhmetshinTonsil
R
4

Understand that the error is an IPV6 network error

  • At first, I updated the version of my composer running this command

    composer -vvv self-update

  • I also followed this instruction from composer doc on resolving IPV6 timed out issue

https://getcomposer.org/doc/articles/troubleshooting.md#operation-timed-out-ipv6-issues-

I can't say which of these did the magic

Roaring answered 14/8, 2019 at 8:2 Comment(0)
N
0

Deleting the https_proxy and http_proxy environment vars worked for me (Windows 10). And then installing it, set proxy in blank. It should work as it did for me.

Nondescript answered 13/10, 2017 at 6:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.