• Debian 11 has reached its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.81 is the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

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