如果不在防火墙或代理后面,Composer 将无法通过 http 连接到 packagist 的一些原因是什么?

What are some reasons why Composer will fail to connect to packagist through http, if not behind a firewall or proxy?

我一直在尝试在 Centos 5.5 上使用 Composer。我设法安装了它,但是 composer install 让我无处可去,产生:

Loading composer repositories with package information
[Composer\Downloader\TransportException]                                                                             
The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Connection timed out 

同样,composer diag 显示以下内容:

Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity: FAIL

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

Checking github.com rate limit: OK
Checking disk free space: OK
Checking composer version:
[Composer\Downloader\TransportException]                                                                         
  The "//getcomposer.org/version" file could not be downloaded: failed to open stream: Connection timed out 

我已经搜索过这个错误并找到了关于如何绕过代理的讨论。但是根据系统管理员的说法,我的 IP 可以完全访问,没有防火墙或代理阻止我。

如何开始解决此问题?

根据 Sven 的建议编辑以添加跟踪路由结果

traceroute to packagist.org (87.98.253.214), 30 hops max, 40 byte packets

1  a9.39.5646.static.theplanet.com (70.86.57.169)  1.258 ms  1.532 ms  1.760 ms
2  po202.dsr01.dllstx2.networklayer.com (70.87.254.145)  0.540 ms  0.579 ms  0.689 ms
3  po21.dsr01.dllstx3.networklayer.com (70.87.255.65)  0.574 ms  0.676 ms  0.796 ms
4  ae17.bbr02.eq01.dal03.networklayer.com (173.192.18.230)  0.406 ms  0.410 ms  0.404 ms
5  * eqx.dal.ovh.net (206.223.118.119)  0.508 ms ae7.bbr01.eq01.dal03.networklayer.com (173.192.18.208)  0.401 ms
6  * dal-1-6k.tx.us (178.32.135.174)  0.559 ms *
7  nwk-1-6k.nj.us (178.32.135.222)  38.725 ms * *
8  nwk-1-6k.nj.us (178.32.135.222)  38.690 ms  38.680 ms  38.773 ms
9  * gra-g1-a9.fr.eu (37.187.36.211)  115.493 ms *
10  gra-3a-a9.fr.eu (37.187.231.86)  113.173 ms gra-g1-a9.fr.eu (37.187.36.211)  113.189 ms  113.294 ms
11  gra-3a-a9.fr.eu (37.187.231.86)  113.022 ms  111.916 ms *
12  * * *
13  * * *
etc until
30  * * *

看来 Sven(在评论中:Sven,如果你愿意 post 作为答案,我会接受)到目前为止有最好的答案:traceroute 显示我们在途中被 gra- 3a-a9.fr.eu。我不知道该怎么办,所以我放弃了在服务器上使用 composer 的尝试。相反,我试图通过在本地主机上安装 composer 来解决这个问题,并且能够很好地连接到 packagist。然后我将所有内容上传到服务器,现在包括 Composer 创建的 "vendor" 目录。

关于如何在本地不使用 composer 的情况下进行安装的更多讨论...此处列出的技术特定于 Laravel,但我发现它适用于其他软件包。 http://jafty.com/blog/installing-laravel-without-composer/

Can I Install Laravel without using Composer?

感谢大家的建议!