PHP Composer behind http proxy

后端 未结 10 2079
日久生厌
日久生厌 2020-11-29 05:45

I use composer on a network where the only way to access the internet is using HTTP or socks proxy. I have http_proxy and https_proxy environment variables. When compose tri

10条回答
  •  独厮守ぢ
    2020-11-29 06:26

    Operation timed out (IPv6 issues)# You may run into errors if IPv6 is not configured correctly. A common error is:

    The "https://getcomposer.org/version" file could not be downloaded: failed to
    open stream: Operation timed out
    

    We recommend you fix your IPv6 setup. If that is not possible, you can try the following workarounds:

    Workaround Linux:

    On linux, it seems that running this command helps to make ipv4 traffic have a higher prio than ipv6, which is a better alternative than disabling ipv6 entirely:

    sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"
    

    Workaround Windows:

    On windows the only way is to disable ipv6 entirely I am afraid (either in windows or in your home router).

    Workaround Mac OS X:

    Get name of your network device:

    networksetup -listallnetworkservices
    

    Disable IPv6 on that device (in this case "Wi-Fi"):

    networksetup -setv6off Wi-Fi
    

    Run composer ...

    You can enable IPv6 again with:

    networksetup -setv6automatic Wi-Fi
    

    That said, if this fixes your problem, please talk to your ISP about it to try and resolve the routing errors. That's the best way to get things resolved for everyone.

    Hoping it will help you!

提交回复
热议问题