PHP Composer在http代理之后 [英] PHP Composer behind http proxy

查看:1040
本文介绍了PHP Composer在http代理之后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网络上使用作曲家,唯一的方式访问互联网是使用HTTP或socks代理。我有http_proxy和https_proxy环境变量。当compose尝试访问HTTPS网址时,我得到:

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 tries to access HTTPS URLs I get this:

 file could not be downloaded: failed to open stream: Cannot connect to HTTPS server through proxy

据我所知,连接到https网站的唯一方法是使用连接动词。

As far as I know the only way to connect to a https website is using a connect verb. How can I use composer behind this proxy?

推荐答案

如果你使用Linux或Unix(包括OS X),你应该将此位置影响您的环境:

If you're on Linux or Unix (including OS X), you should put this somewhere that will affect your environment:

export HTTP_PROXY_REQUEST_FULLURI=0 # or false
export HTTPS_PROXY_REQUEST_FULLURI=0 #

可以将其放在 / etc / profile 以全局影响机器上的所有用户,或者您自己的〜/ .bashrc 〜/ .zshrc

You can put it in /etc/profile to globally affect all users on the machine, or your own ~/.bashrc or ~/.zshrc, depending on which shell you use.

如果你在Windows上,打开环境变量控制面板,并添加一个系统或用户环境变量与 HTTP_PROXY_REQUEST_FULLURI HTTPS_PROXY_REQUEST_FULLURI 设置为 0 false

If you're on Windows, open the Environment Variables control panel, and add either a system or user environment variables with both HTTP_PROXY_REQUEST_FULLURI and HTTPS_PROXY_REQUEST_FULLURI set to 0 or false.

对于其他读这个的人(不是你,因为你说你有这些设置),确保 HTTP_PROXY HTTPS_PROXY 设置为正确的代理,使用相同的方法。如果你在Unix / Linux / OS X上,设置变量名的大写和小写版本是最完整的方法,因为一些只使用小写版本,而IIRC有些使用大写。 (我经常使用一种混合环境,Windows上的Cygwin,我知道对于这两者都很重要,但是纯粹的Unix / Linux环境可能只能使用小写)。

For other people reading this (not you, since you said you have these set up), make sure HTTP_PROXY and HTTPS_PROXY are set to the correct proxy, using the same methods. If you're on Unix/Linux/OS X, setting both upper and lowercase versions of the variable name is the most complete approach, as some things use only the lowercase version, and IIRC some use the upper case. (I'm often using a sort of hybrid environment, Cygwin on Windows, and I know for me it was important to have both, but pure Unix/Linux environments might be able to get away with just lowercase.)

如果您在完成所有这些操作后仍然无法正常工作,并确定您设置了正确的代理地址,请检查您的公司是否使用Microsoft代理服务器。如果是这样,您可能需要安装 Cntlm 作为子代理,以在Composer(等)和Microsoft代理服务器之间进行连接。 Google CNTLM有关如何设置的详细信息和说明。

If you still can't get things working after you've done all this, and you're sure you have the correct proxy address set, then look into whether your company is using a Microsoft proxy server. If so, you probably need to install Cntlm as a child proxy to connect between Composer (etc.) and the Microsoft proxy server. Google CNTLM for more information and directions on how to set it up.

这篇关于PHP Composer在http代理之后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆