无法在代理后面的 Ubuntu 上安装 Composer
Can't install Composer on Ubuntu behind proxy
我正在尝试安装 Composer,以便使用 Laravel,但我使用的是公司代理。代理已在系统中配置,所以
wget --proxy-user=<my_user_name> --proxy-password=<my_password> https://getcomposer.org/installer
有效(curl 无效!),我得到了 270kB "installer" 文件。
接下来,我要运行
php installer
如 manual 所说,但随后出现以下错误:
All settings correct for using Composer
Downloading...
Download failed: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: Cannot connect to HTTPS server through proxy
错误重复3次,然后程序退出。如果我在 "php" 之前放置一个 "sudo",那么什么也不会发生(它卡在 "Downloading..." 中),就好像 php 在等待什么。使用
printenv | grep proxy
我明白了
http_proxy=http://<my_proxy_host>:<port_number>/
ftp_proxy=ftp://<my_proxy_host>:<port_number>/
all_proxy=socks://<my_proxy_host>:<port_number>/
ALL_PROXY=socks://<my_proxy_host>:<port_number>/
socks_proxy=socks://<my_proxy_host>:<port_number>/
https_proxy=https://<my_proxy_host>:<port_number>/
no_proxy=localhost,127.0.0.0/8,::1
它不应该工作吗?我正在使用新安装的 Ubuntu 14.04。我正在关注 this tutorial,但我卡在了第 8 步(即我已经安装了 Apache 和 PHP 版本 5.5.9-1ubuntu4.9。)
提前致谢!
编辑:这不是 this question 的副本,因为我什至无法安装 Composer! PHP 中的 OpenSSL 不是有问题的 0.9.8 系列(它是 1.0.1f)。我在 /etc/profile 处设置了 export HTTP_PROXY_REQUEST_FULLURI=0 和 export HTTPS_PROXY_REQUEST_FULLURI=0。我有上面显示的代理变量。也许问题出在 CNTLM 的东西上?我去找找。
只需手动安装即可。
首先下载文件
wget https://getcomposer.org/composer.phar
然后将它移到 /usr/bin 下以在全球范围内使用它。
sudo mv composer.phar /usr/bin/composer
应该在 Ubuntu 14 上做到这一点。
我得到了附近专家的帮助:
添加 3 行到 /etc/profile
export http_proxy=http://[username]:[password]@[webproxy]:[port]
export https_proxy=http://[username]:[password]@[webproxy]:[port]
export ftp_proxy=http://[username]:[password]@[webproxy]:[port]
对于类似的错误(apt-get 更新未到达某些存储库),我编辑了 /etc/apt/apt.conf:
Acquire::http::proxy "http://[username]:[password]@[webproxy]:[port]";
Acquire::https::proxy "https://[username]:[password]@[webproxy]:[port]";
Acquire::ftp::proxy "ftp://[username]:[password]@[webproxy]:[port]";
注意删除端口号后的“/”(它已经存在)。
现在一切正常。
我正在尝试安装 Composer,以便使用 Laravel,但我使用的是公司代理。代理已在系统中配置,所以
wget --proxy-user=<my_user_name> --proxy-password=<my_password> https://getcomposer.org/installer
有效(curl 无效!),我得到了 270kB "installer" 文件。
接下来,我要运行
php installer
如 manual 所说,但随后出现以下错误:
All settings correct for using Composer
Downloading...
Download failed: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: Cannot connect to HTTPS server through proxy
错误重复3次,然后程序退出。如果我在 "php" 之前放置一个 "sudo",那么什么也不会发生(它卡在 "Downloading..." 中),就好像 php 在等待什么。使用
printenv | grep proxy
我明白了
http_proxy=http://<my_proxy_host>:<port_number>/
ftp_proxy=ftp://<my_proxy_host>:<port_number>/
all_proxy=socks://<my_proxy_host>:<port_number>/
ALL_PROXY=socks://<my_proxy_host>:<port_number>/
socks_proxy=socks://<my_proxy_host>:<port_number>/
https_proxy=https://<my_proxy_host>:<port_number>/
no_proxy=localhost,127.0.0.0/8,::1
它不应该工作吗?我正在使用新安装的 Ubuntu 14.04。我正在关注 this tutorial,但我卡在了第 8 步(即我已经安装了 Apache 和 PHP 版本 5.5.9-1ubuntu4.9。)
提前致谢!
编辑:这不是 this question 的副本,因为我什至无法安装 Composer! PHP 中的 OpenSSL 不是有问题的 0.9.8 系列(它是 1.0.1f)。我在 /etc/profile 处设置了 export HTTP_PROXY_REQUEST_FULLURI=0 和 export HTTPS_PROXY_REQUEST_FULLURI=0。我有上面显示的代理变量。也许问题出在 CNTLM 的东西上?我去找找。
只需手动安装即可。
首先下载文件
wget https://getcomposer.org/composer.phar
然后将它移到 /usr/bin 下以在全球范围内使用它。
sudo mv composer.phar /usr/bin/composer
应该在 Ubuntu 14 上做到这一点。
我得到了附近专家的帮助:
添加 3 行到 /etc/profile
export http_proxy=http://[username]:[password]@[webproxy]:[port]
export https_proxy=http://[username]:[password]@[webproxy]:[port]
export ftp_proxy=http://[username]:[password]@[webproxy]:[port]
对于类似的错误(apt-get 更新未到达某些存储库),我编辑了 /etc/apt/apt.conf:
Acquire::http::proxy "http://[username]:[password]@[webproxy]:[port]";
Acquire::https::proxy "https://[username]:[password]@[webproxy]:[port]";
Acquire::ftp::proxy "ftp://[username]:[password]@[webproxy]:[port]";
注意删除端口号后的“/”(它已经存在)。
现在一切正常。