PHP-安装Composer-无法打开流:php_network_getaddresses:getaddrinfo失败:此类主机未知 [英] PHP - Installing Composer - failed to open stream: php_network_getaddresses: getaddrinfo failed: No such host is known

查看:85
本文介绍了PHP-安装Composer-无法打开流:php_network_getaddresses:getaddrinfo失败:此类主机未知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 Composer Dependency Manager 用于PHP,但是当我使用Composer-Setup.exe(Win32安装程序)。

I am attempting to use the Composer Dependency Manager for PHP, but I am experiencing the following issue when I use the Composer-Setup.exe (Win32 installer).

Download failed: php_network_getaddresses: getaddrinfo failed: No such host is known. 
failed to open stream: php_network_getaddresses: getaddrinfo failed: No such host is known. 
Download failed: php_network_getaddresses: getaddrinfo failed: No such host is known. 
failed to open stream: php_network_getaddresses: getaddrinfo failed: No such host is known. 
Download failed: php_network_getaddresses: getaddrinfo failed: No such host is known. 
failed to open stream: php_network_getaddresses: getaddrinfo failed: No such host is known. 
The download failed repeatedly, aborting.`

我在其他几个stackoverflow线程上遵循了建议。对于该错误,我已经检查了其他一些论坛。在我的php.ini中,确保已具有以下选项:

I followed the advice on several other stackoverflow threads for that error, and I've checked some other forums. In my php.ini, I have made sure I have the following options:

allow_url_fopen = On
allow_url_include = On
extension=php_openssl.dll

我也尝试了手动安装Composer ,要求您执行以下操作:

I also tried the manual installation of Composer, which asks you to execute:

php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"

我从中得到同样的错误。但是,如果删除 / installer,它可以检索源。我已验证 /安装程序 URL可以正常工作。什么配置可能导致此行为?我在32位Windows 7上运行PHP 5.4。

I get the same error from that. However, If I remove "/installer", it can retrieve the source. I have verified that that the "/installer" URL works. What configuration could cause this behavior? I'm running PHP 5.4 on 32-bit Windows 7.

谢谢,
Andrew

Thanks, Andrew

推荐答案

此问题实际上是代理变量。在控制台获取更改的同时,PHP需要重新启动系统才能进行更改。因此,取消设置环境变量并重新启动允许Composer安装程序检索所需的文件。感谢塞尔达克(Seldaek)提出的检查代理的建议。

This issue was actually the proxy variables. While the console was picking up the changes, PHP required a system restart to pick it up. So unsetting the environment variables and restarting allowed the Composer installer to retrieve the required files. Thanks Seldaek for your recommendation to check the proxy.

这篇关于PHP-安装Composer-无法打开流:php_network_getaddresses:getaddrinfo失败:此类主机未知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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