Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

composer failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known

I'm new in lumen and i have done

composer clear-cache then after

composer update

to install some package after configurating composer.json however i have got this error:

[Composer\Downloader\TransportException]                                     
  The "http://packagist.org/p/phpunit/php-timer%24be3efc71adf134c858c1add0117  
  f060f4ab545fe9d357983c7bea165b2008d65.json" file could not be downloaded: p  
  hp_network_getaddresses: getaddrinfo failed: Name or service not known       
  failed to open stream: php_network_getaddresses: getaddrinfo failed: Name o  
  r service not known  

Plase how could i fix this error

like image 549
DINA TAKLIT Avatar asked Jan 29 '23 14:01

DINA TAKLIT


2 Answers

This issue was posted about 2 years ago but I wanna answer this problem so no one should have difficulty like me.

First open /etc/resolv.conf

(if you using Ubuntu distributions, the file is /etc/resolvconf/resolv.conf.d/head)

# cat /etc/resolve.conf

And after that, write this rows to the file:

# Google's public DNS servers
nameserver 8.8.8.8    # Primary DNS server
nameserver 8.8.4.4    # Secondary DNS server

These are the Google's public DNS servers as mentioned in the code above.

Save and close.

After restart the network service using this command:

service network restart

This solved my problem.

Hope help to others...

like image 158
Arda Örkin Avatar answered Feb 13 '23 05:02

Arda Örkin


I fixed the issue on Linux/Centos6 (Plesk Onyx) by:

Opening /etc/resolv.conf (my file was empty)

Added: nameserver 8.8.8.8 nameserver 8.8.4.4

options rotate options timeout:3

Hopefully this helps someone out there.

like image 44
Rassoni Avatar answered Feb 13 '23 07:02

Rassoni