代理背后的作曲家,设置,仍然无法正常工作

时间:2015-10-22 14:11:31

标签: laravel proxy composer-php

我的VirtualBox与Ubuntu 14.04背后的代理。我已经安装了Apache2,PHP,MySQL和Composer。我做了谷歌,设置系统范围的代理,代理apt-get和git。根据这个:

deralsem@DerVirtualBox:/var/www/laravel$ composer diag
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking **HTTP proxy**: OK
Checking **HTTP proxy support for request_fulluri**: OK
Checking **HTTPS proxy support for request_fulluri**: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking composer version: OK

Composer已设置为代理使用。但是,尝试这个:

$ cd /var/www
$ git clone https://github.com/laravel/laravel.git
Navigate to Laravel code directory and use composer to install all dependencies required for Laravel framework.
$ cd /var/www/laravel
$ sudo composer install

我有这个:

Loading composer repositories with package information
[Composer\Downloader\TransportException]                                                 
  The "https://packagist.org/packages.json" file could not be downloaded: php_network_getaddresses: getaddrinfo failed: No address associated with hostname                       
  failed to open stream: php_network_getaddresses: getaddrinfo failed: No address associated with hostname                                                                        

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [packages1] ... [packagesN]

任何建议都表示赞赏。

1 个答案:

答案 0 :(得分:0)

请尝试将HTTP_PROXY设置为环境变量

export HTTP_PROXY="http://the.proxy"
php composer.phar install

也许export HTTPS_PROXY_REQUEST_FULLURI=0

参考:https://getcomposer.org/doc/03-cli.md#http-proxy-or-http-proxy

(当诊断命令未正确报告环境问题时,可能是Composer错误。)

错误消息php_network_getaddresses: getaddrinfo failed: No address associated with hostname表示DNS问题。

似乎未正确配置代理的DNS解析。

请尝试将/etc/resolv.conf文件中的名称服务器更改为其他名称服务器,例如sudo echo "nameserver 8.8.8.8" >> /etc/resolv.conf

然后你可以ping Packagist的URL和IP地址。

请求网址(主机名):https://packagist.org/

远程地址:87.98.253.214:443