使用代理解决composer缓慢问题
- LINUX
- 2018-08-08
- 1744
- 0
使用代理解决composer不能连接,缓慢等问题
1.检查composer配置 输入 composer diagnose 出现如下错误
MacBook-Pro:mobile me$ composer diagnose
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: WARNING
[Composer\Downloader\TransportException] The "http://packagist.org/packages.json" file could not be downloaded: failed to open stream: HTTP request failed!
Checking https connectivity to packagist: WARNING
[Composer\Downloader\TransportException] The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Connection refused
Checking HTTP proxy: FAIL
[Composer\Downloader\TransportException] The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Connection refused
Checking HTTP proxy support for request_fulluri: WARNING
Unable to assess the situation, maybe packagist.org is down (The "http://packagist.org/packages.json" file could not be downloaded: failed to open stream: HTTP request failed! )
Checking HTTPS proxy support for request_fulluri: WARNING
Unable to assess the situation, maybe github is down (The "https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0" file could not be downloaded: failed to open stream: Connection refused)
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 refused
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0 87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B 0C708369 153E328C AD90147D AFE50952
OK
Checking composer version:
[Composer\Downloader\TransportException] The "https://getcomposer.org/versions" file could not be downloaded: failed to open stream: Connection refused
diagnose
2.mac下配置终端代理
$ export http_proxy='http://127.0.0.1:1080' # 配置http访问的
$ export https_proxy='http://127.0.0.1:1080' # 配置https
$ export ALL_RPOXY='http://127.0.0.1:1080' # 配置http和https访问
3.composer.json文件中增加取消https验证
1.直接修改项目中的composer.json
"config": {
"secure-http": false
},
2.或者直接全局取消https验证
composer config -g secure-http false
4.取消代理设置
$ unset http_proxy
$ unset https_proxy
$ unset ALL_RPOXY
win10 配置composer代理
方法同 2.3.4 我使用的 git bash 脚本命令执行的
查看变量 使用 echo $http_proxy