• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.

Issue php_network_getaddresses: getaddrinfo failed: Name or service not known

Timo002

Basic Pleskian
Hello,

I'm running Plesk Onyx 17.8.11 Update #7 on CentOs 7.4.1708.

When I run the PHP function file_get_contents() in my code, I'm getting an error:
Code:
file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/...

When running a php script from CLI, it is working fine.

What have I checked and done:
  1. I have 'allow_url_fopen' enabled (was already enabled)
  2. I tried to disable the firewall, no success
  3. I tried to disable selinux, no success
  4. I tried to add nameserver 8.8.8.8 and 4.4.4.4 to /etc/resolv.conf, did `service httpd restart`, no success
What else can I try?
 
@IgorG I added port 53 tcp to allow both outgoing and incomming. Doesn't work either.

The strange thing is dat from CLI this works fine, but not when I run the command from the browser.
 
Same problem here after i added nameserver 127.0.0.1 to /etc/resolv and delete the old one. And ideas?
 
"getaddrinfo failed: Name or service not known" can have many different reasons, non only a closed port. Very frequent mistakes are malformed addresses in the function, e.g. "htp://" instead of "http://" or "http:// myaddress.com" instead of "http://myaddress.com" etc. First thing to check is whether a correct address is used.

Adding localhost as a nameserver only makes sense if there is actually a nameserver running on the machine and it can deliver the data that is requested. I think having localhost as the only nameserver in /etc/resolv is a bad idea.
 
Thanks for the fast reply. I thought so too, but when I entered the provider DNS server again, everything worked again.

Why localhost as the only nameserver in /etc/resolv is a bad idea? "Plesk's bind" is a full DNS server, or not? :S Is it not possible to use it as a normal DNS server?
 
Hello,

I'm running Plesk Onyx 17.8.11 Update #7 on CentOs 7.4.1708.

When I run the PHP function file_get_contents() in my code, I'm getting an error:
Code:
file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/...

When running a php script from CLI, it is working fine.

What have I checked and done:
  1. I have 'allow_url_fopen' enabled (was already enabled)
  2. I tried to disable the firewall, no success
  3. I tried to disable selinux, no success
  4. I tried to add nameserver 8.8.8.8 and 4.4.4.4 to /etc/resolv.conf, did `service httpd restart`, no success
What else can I try?
Any idea about this dns problem ? Thanks!
 
Back
Top