DNS resolution within PHP

From: Date: Fri, 13 May 2022 23:16:02 +0000
Subject: DNS resolution within PHP
Groups: php.install 
Request: Send a blank email to php-install+get-20558@lists.php.net to get a copy of this message
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


Thread (1 message)

  • Michael Hallager via php-install
« previous php.install (#20558) next »