Wednesday, June 10, 2009

getaddrinfo() failed in Apache 2.2 + FreeBSD 6.1

getaddrinfo() failed in Apache 2.2 + FreeBSD 6.1

* From: "Tamouh Hakmi"
* Date: Sat, 16 Aug 2008 17:56:43 -0400

Hi,

I'm working on a problem with Apache 2.2 + PHP on FreeBSD 6.1 x86

Recently, I've upgraded from Apache 1.3 to v2.2 , and since then PHP is unable to resolve hostnames unless they're specified in /etc/hosts . The error we'd get would be:

php_network_getaddresses: getaddrinfo failed: hostname nor servname provided, or not known in /home/username/public_html/testphp.php on line 2

This is for a simple function. I know it is not a DNS problem, because if PHP is setup as a CGI function, it works fine. It is only in DSO mode that PHP malfunction like this. I'm also having no issues with our resolver for mail, ping or any other services.

Some people were pointing out that this is a fault of FreeBSD reaching a maximum number of file descriptors. Others said this can't be resolved until upgraded to FBSD 6.3 which I'm not planning to go through. There are several hundred domains hosted on the server, but all was working fine with Apache 1.3.

Our VNODES are a bit high, but haven't seen any errors:

server# sysctl kern.maxvnodes
kern.maxvnodes: 100000
server# sysctl vfs.numvnodes
vfs.numvnodes: 84805

server# sysctl kern.maxfiles
kern.maxfiles: 65536
kern.maxfilesperproc: 32767

Later on I've discovered that if I comment about 500 CustomLog entries in Apache, the errors will disappear. This seems like an issue with a certain limit with open files.

Anyone be able to guide me in the right direction here?

Thanks,

Tamouh

No comments: