This is a note for anyone out there who has run into this problem on Mac OS X Server: your program needs to resolve a host name, and works fine from the command line. However, when run from Apache, host names fail to resolve, and you get the error message "temporary failure in name resolution" in your Apache error_log. You may be tearing your hair out, because from the command line, DNS resolution works fine, but somehow, any program run from Apache can't resolve a DNS lookup.
The problem is not with your DNS server, or your Apache setup. It does not depend on what language you use to write your programs, either. You need to make sure that httpd starts using the program "StartupItemContext" so that its Mach ports are set up correctly! This is found in /usr/libexec/ and will fix the problem.
So, you must use /usr/libexec/StartupItemContext to run Apache. This will fix it. Do this!
And boost the signal! I drove myself nearly crazy looking for solutions for months before I found this out.
The problem is not with your DNS server, or your Apache setup. It does not depend on what language you use to write your programs, either. You need to make sure that httpd starts using the program "StartupItemContext" so that its Mach ports are set up correctly! This is found in /usr/libexec/ and will fix the problem.
So, you must use /usr/libexec/StartupItemContext to run Apache. This will fix it. Do this!
And boost the signal! I drove myself nearly crazy looking for solutions for months before I found this out.