我有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
[ComposerDownloaderTransportException]
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]
欢迎指教
请尝试将HTTP_PROXY
设置为环境变量
HTTP_PROXY='http://the.proxy'
export HTTP_PROXY
php composer.phar install
和
HTTPS_PROXY_REQUEST_FULLURI=0
export HTTPS_PROXY_REQUEST_FULLURI
引用: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
文件中的名称服务器更改为其他名称服务器,例如Google Inc.,通过附加其中一个DNS服务器IPv4地址(resolv.conf(5)):
sudo printf 'nnameserver 8.8.8.8n' >> /etc/resolv.conf
然后您可以ping
的URL和Packagist的IP地址。
请求URL(主机名):https://packagist.org/
远程地址:87.98.253.214:443