今天重装了composer,重装后使用时出现超时错误如下
qi@qi-ideacentre-AIO-300-23ISU:/var/www/html$ composer create-project --prefer-dist laravel/laravel blog
[Composer\Downloader\TransportException]
The "https://repo.packagist.org/packages.json" file could not be downloaded
: failed to open stream: Connection timed out
使用过composer中国镜像,然而报错信息与之前一模一样。
运行环境如下
ubuntu 16.04.1
php 7.1
composer 1.9
composer config如下
[repositories.packagist.org.type] composer
[repositories.packagist.org.url] https://packagist.phpcomposer.com
[process-timeout] 300
[use-include-path] false
[preferred-install] auto
[notify-on-install] true
[github-protocols] [https, ssh]
[vendor-dir] vendor (/var/www/html/vendor)
[bin-dir] {$vendor-dir}/bin (/var/www/html/vendor/bin)
[cache-dir] /home/qi/.cache/composer
[data-dir] /home/qi/.local/share/composer
[cache-files-dir] {$cache-dir}/files (/home/qi/.cache/composer/files)
[cache-repo-dir] {$cache-dir}/repo (/home/qi/.cache/composer/repo)
[cache-vcs-dir] {$cache-dir}/vcs (/home/qi/.cache/composer/vcs)
[cache-ttl] 15552000
[cache-files-ttl] 15552000
[cache-files-maxsize] 300MiB (314572800)
[bin-compat] auto
[discard-changes] false
[autoloader-suffix]
[sort-packages] false
[optimize-autoloader] false
[classmap-authoritative] false
[apcu-autoloader] false
[prepend-autoloader] true
[github-domains] [github.com]
[bitbucket-expose-hostname] true
[disable-tls] false
[secure-http] true
[cafile]
[capath]
[github-expose-hostname] true
[gitlab-domains] [gitlab.com]
[store-auths] prompt
[archive-format] tar
[archive-dir] .
[htaccess-protect] true
[use-github-api] true
[home] /home/qi/.config/composer
附加信息:报错信息中的https://repo.packagist.org/packages.json在我的浏览器上是能打开的,域名也能ping通
qi@qi-ideacentre-AIO-300-23ISU:/var/www/html$ ping repo.packagist.org
PING repo.packagist.org (54.38.136.239) 56(84) bytes of data.
64 bytes from ip-54-38-136.eu (54.38.136.239): icmp_seq=1 ttl=39 time=362 ms
64 bytes from ip-54-38-136.eu (54.38.136.239): icmp_seq=2 ttl=39 time=371 ms
64 bytes from ip-54-38-136.eu (54.38.136.239): icmp_seq=3 ttl=39 time=391 ms
64 bytes from ip-54-38-136.eu (54.38.136.239): icmp_seq=4 ttl=39 time=359 ms
^C
--- repo.packagist.org ping statistics ---
5 packets transmitted, 4 received, 20% packet loss, time 4002ms
rtt min/avg/max/mdev = 359.543/371.305/391.974/12.752 ms