• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • 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.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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