DNS resolution within PHP

[email protected] ("Michael Hallager via php-install") Sat, 14 May 2022 11:16:02 +1200
Newsgroups php.install
Organization Net Trust Ltd
Message-ID <[email protected]>
Hi all,

I am facing a problem on a new install server. It is running Linux, 
Apache and PHP via PHP-FPM. It uses a config and chroot which I have 
successfully deployed on several other servers with various releases of 
Linux which were current at the time of install. For this reason, I 
believe its potentially a library issue.

This is also supported by the fact it works in a non PHP-FPM/Chroot 
environment.

This initially showed by Wordpress failing to update with the somewhat 
meaningless error "Update failed: Download failed. A valid URL was not 
provided." So I run further tests from scratch and found, for example, 
file_get_contents() returns the following error: 
"php_network_getaddresses: getaddrinfo failed: System error in..."

With this information I have narrowed it down to a DNS issue because 
when I add hostname -> IP address records into the hosts file, it works. 
This would seem to rule out other issues like TLS/HTTPS.

In my Chroot I have the following relevant files. This is the same 
chroot environment I have used successfully on other servers.
/etc/resolv.conf
/etc/hosts
/lib64/libnss_dns.so.2

So I am thinking something is broken or missing which shows up on this 
server and no others so possibly something has changed since they were 
installed.

Can someone please assist me by shedding some light on the internals of 
PHP DNS resolution and what it needs to operate?

Any further questions are welcome.

Thanks,

Michael Hallager