使用代理解决composer缓慢问题

使用代理解决composer不能连接,缓慢等问题

1.检查composer配置 输入 composer diagnose 出现如下错误

  1. MacBook-Pro:mobile me$ composer diagnose
  2. Checking composer.json: OK
  3. Checking platform settings: OK
  4. Checking git settings: OK
  5. Checking http connectivity to packagist: WARNING
  6. [Composer\Downloader\TransportException] The "http://packagist.org/packages.json" file could not be downloaded: failed to open stream: HTTP request failed!
  7. Checking https connectivity to packagist: WARNING
  8. [Composer\Downloader\TransportException] The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Connection refused
  9. Checking HTTP proxy: FAIL
  10. [Composer\Downloader\TransportException] The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Connection refused
  11. Checking HTTP proxy support for request_fulluri: WARNING
  12. 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! )
  13. Checking HTTPS proxy support for request_fulluri: WARNING
  14. 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)
  15. Checking github.com rate limit: FAIL
  16. [Composer\Downloader\TransportException] The "https://api.github.com/rate_limit" file could not be downloaded: failed to open stream: Connection refused
  17. Checking disk free space: OK
  18. Checking pubkeys:
  19. Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0 87719BA6 8F3BB723 4E5D42D0 84A14642
  20. Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B 0C708369 153E328C AD90147D AFE50952
  21. OK
  22. Checking composer version:
  23. [Composer\Downloader\TransportException] The "https://getcomposer.org/versions" file could not be downloaded: failed to open stream: Connection refused
  24. diagnose

2.mac下配置终端代理

  1. $ export http_proxy='http://127.0.0.1:1080' # 配置http访问的
  2. $ export https_proxy='http://127.0.0.1:1080' # 配置https
  3. $ export ALL_RPOXY='http://127.0.0.1:1080' # 配置http和https访问

3.composer.json文件中增加取消https验证

  1. 1.直接修改项目中的composer.json
  2. "config": {
  3. "secure-http": false
  4. },
  5. 2.或者直接全局取消https验证
  6. composer config -g secure-http false

4.取消代理设置

  1. $ unset http_proxy
  2. $ unset https_proxy
  3. $ unset ALL_RPOXY

win10 配置composer代理

  1. 方法同 2.3.4 我使用的 git bash 脚本命令执行的
  2. 查看变量 使用 echo $http_proxy


评论 0

发表评论

Top