PHP - installing Composer - could not open the stream: php_network_getaddresses: getaddrinfo failed: such a host is not known

I am trying to use Composer Dependency Manager for PHP, but I am experiencing the following problem when I use 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.` 

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

 allow_url_fopen = On allow_url_include = On extension=php_openssl.dll 

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

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

I get the same error from this. However, if I remove "/ installer", it can extract the source. I checked that the url "/ installer" is working. What configuration can cause this behavior? I am running PHP 5.4 on 32-bit Windows 7.

Thanks Andrew

+6
source share
3 answers

This problem was actually proxy variables. While the console was collecting changes, PHP required a system reboot to pick it up. Thus, to disable environment variables and restart, the Composer installer was able to restore the required files. Thanks to Seldaek for recommending checking proxies.

+2
source

Below is the error that usually occurs if proxy settings exist

Solution 1

  • Make sure you have ping connectivity at www.google.com.

Decision 2

 - Remove Proxy settings ,they could be ones causing it,if outside a corporate network 

Decision 3

0
source
 mysqli_connect('root','', 'localhost', 'people'); 

You pass the root as the host name.

try it

 mysqli_connect('localhost','root', '', 'people'); 

this will connect to localhost with the root username passwoord "" and people with the default database.

it might be better to change localhost with 127.0.0.1

-6
source

All Articles