Apache-2.2.10 / Chroot and cURL is giving me some grief (SOLVED)

So my woes with Apache-2.2.10 and chroot is continuing. Now I can start Apache in the chroot environment, and I thought all was well, but after additional testing, I found out that cURL does not work. Basically, cURL will return a empty string while it's chroot'd. This is very weird to me, since the jail is EXACTLY the same as it was when mod_chroot was set up initially. This would mean the libraries should all be good still. I tested with the apache out of the jail and cURL works great. I've seen multiple mention of this problems, but usually related to https requests while in the jail. I've encountered those in the past (usually related to certs, urandom, etc missing from the jail). This problem is with straight http requests. I did find one very similar post here: http://kerneltrap.org/mailarchive/openbsd-misc/2007/3/21/146482/thread. Of course, the thread died out without any resolution.

I went ahead and posted a thread on the Gentoo forums (http://forums.gentoo.org/viewtopic-p-5401286.html. Not expecting much, since this is more specific than the apache/chroot problem initially, which got zero follow ups. I also posted on the curl mailing list, I'm expecting some good replies here. I'll add any follow-ups as they come. I'm sure there are a few people like me that are dealing with these problems.

---- UPDATE -----
Okay, I was able to figure out the problem. mod_chroot was calling a file load on the ifdefine

LoadFile /lib/libnss_dns.so.2

I added this to the main httpd.conf, and cURL works again. Talk about a pain in the ass.

At least I was on the right track. Apologies to previous posters.
Dave.

This post didn't *exactly* help solve my problem but pointed me in the right direction to look and find where my problem was. Let me summarise what my problem was in case it's useful for others and how I debugged it if you will.

Problem:
php curl worked from a command line executed php script (a la #> php -f script.php) but does not when apache tries to run it eg http://www.mywebsite.com/script.php
VIP: apache is in a chroot jail. My script was attempting to do a HTTP POST with php curl to an external server.

After reading this post I thought that maybe it was a DNS type issue as my browser was taking 60,90 seconds to timeout but the command line invocation was immediate. It's common to see DNS requests have a 30 second timeout with one or more retries.

After reading this post and trying what was suggested it made no difference so I thought if I could do an strace on apache I could find out what was happening.

So I started up apache as per normal but added to -X switch which makes it start up with just one child, itself so to speak. Next i got the pid of this apache process.

Attack strace to it and save/tail output.

strace -p 2>&1 | tee report

Then, in your web browser try the URL again. You should see a pile on output from the strace.

What I noticed was my DNS lookups (look for a "53") were timing out. Reason?
The nameservers in my /etc/resolv.conf were *different* (and wrong) to the ones in the chroot environment (ex /chroot/apache/etc/resolv.conf) resolv.conf so apache did not know the right nameserver to go to.

How to fix? Simple. I copied my /etc/resolv.conf to /chroot/apache2/etc/resolv.conf.
Restarted apache normally for good measure and retested. All good.

This problem was driving me nuts for days! No more.