Composer Installer warning no such host is known, failed to open stream - php

I am trying to install composer on windows 10 I am getting the following error, and when I am trying to enter composer -v through cmd I am getting error also, means composer not installed in my computer, The error or warning I am getting is this
"The "https://getcomposer.org/versions" file could not be downloaded: 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 "https://getcomposer.org/download/1.10.10/composer.phar.sig" file could not be downloaded: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Please help some one.

You can try again but everything is working now. Maybe there is some network issue at your end (firewall, proxy, etc).
Download composer.phar instead https://getcomposer.org/composer-stable.phar
and then you can run "php composer-stable.phar".

Related

Getting error in Composer setup

I am installing Composer software in my system, but it is showing given below error. Please suggest a solution.
The "https://getcomposer.org/versions" file could not be downloaded: php_network_getaddresses: getaddrinfo failed: This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server.
failed to open stream: php_network_getaddresses: getaddrinfo failed: This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server.

Updating PHP errors due to php_network_getaddresses failed error

So this morning I discover my website payment forms where breaking and on further investigation I discovered that it would appear that my server (Ubuntu 14.4) is unable to connect to the outside world, namely:
Running from CLI:
$php composer.phar self-update
[Composer\Downloader\TransportException]
The "https://getcomposer.org/version" file could not be downloaded:
php_network_getaddresses: getaddrinfo failed: Name or service not
known failed to open stream: php_network_getaddresses: getaddrinfo
failed: Name or service not known
or a dig:
$ dig www.google.com
; <<>> DiG 9.9.5-3ubuntu0.1-Ubuntu <<>> www.google.com ;; global
options: +cmd ;; connection timed out; no servers could be reached
Apache:
exception 'ErrorException' with message 'stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known'
Similar posts on stack: here would suggest I change name servers...
So I am thinking that I should set up the server to use googles name servers:
nameserver 8.8.8.8
nameserver 8.8.4.4
How is this done on Ubuntu 14.4 ?

PHP stream_socket_client() Warning

I am building a new WordPress site for a client and all of a sudden today I am seeing this error at the top of the screen. I have never seen this before. Any ideas what could be causing this to happen now? Also how to fix it?
Warning: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/wp-includes/class-http.php on line 787
Warning: stream_socket_client(): unable to connect to tcp://www.MY-DOMAIN.com:80 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /var/www/wp-includes/class-http.php on line 787
Not sure if you are using a VM but when I had this error I resolved it by adding an entry to my hosts file in my vagrant machine that pointed back to localhost.
127.0.0.1 www.MY-DOMAIN.com

composer update on mac not working

Since I updated my PHP version to 5.4, I have trouble to update composer on my symphony 2 project.
$ php composer.phar update
gives me:
The "https://packagist.org/packages.json" file could not be downloaded: php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known
failed to open stream: php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known
_https://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
[RuntimeException]
Failed to execute git status --porcelain --untracked-files=no
error: bad index file sha1 signature
fatal: index file corrupt
Here is link to a screenshot:
http://sanofuzir.com/Screen.jpg
What should I do?
it's more likely that you can't even ping the url on the console.
then try the solution here: https://discussions.apple.com/message/10713911#10713911
just refresh your DHCP address, and it works for me!

PHP - Installing Composer - failed to open stream: php_network_getaddresses: getaddrinfo failed: No such host is known

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.`
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
I also tried the manual installation of Composer, which asks you to execute:
php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
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.
Thanks,
Andrew
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.
Solution 1
Ensure you have connectivity try ping www.google.com
Solution 2
- Remove Proxy settings ,they could be ones causing it,if outside a corporate network
Solution 3
Add the corporate proxy setting if on a corporate network
set http_proxy=http://your_proxy:your_port
set http_proxy=http://username:password#your_proxy:your_port
set https_proxy=https://your_proxy:your_port
set https_proxy=https://username:password#your_proxy:your_port
mysqli_connect('root','', 'localhost', 'people');
You are passing root in as hostname.
try this
mysqli_connect('localhost','root', '', 'people');
this will connect to localhost with username root passwoord "" and default database people.
maybe better to change localhost with 127.0.0.1

Categories