curl-and-php
Re: 'Couldn't resolve host' error since relocating server
Date: Tue, 18 Aug 2009 17:59:33 +0200
Indeed, This seems not to be a cUrl problem. However why does this problem
only occurs with php/libcurl and not with the CLI?
Even worse: if I run 'host dns.be' it returns the requested dns data. which
normaly uses the same routines as gethostbyname() (the c function curl uses
for this).
So this could mean this is perhaps not a dns/bind problem and a fault in how
curl caches dns data or handles ipv4/ipv6 adresses?
I first thought is was a problem with the new glibc version (updated to 2.10
today) but the problem also occured when running glibc 2.8 this morning. See
this http://udrepper.livejournal.com/20948.html on the 2.10 problem The
suggested workaround do not work (I saw this comming up i a lot of forums)
Is there someone familiar with this kind of problems?
I really need this to work again.
Thanks in advance,
Tom Van de Putte
On Tue, Aug 18, 2009 at 4:56 PM, Tom Worster <fsb_at_thefsb.org> wrote:
> sounds like it's not curl's fault. if a host name can't be resolved then
> all
> apps will fail to connect.
>
> On 8/18/09 10:39 AM, "Tom Van de Putte" <goldfrapper_at_gmail.com> wrote:
>
> > I found out that when I add the requested domain to my /etc/hosts file
> (and
> > thus bypass any dns requests), curl runs and return just fine. So
> probably
> > the error is somewhere in dns/bind? My /etc/host.conf lookup order is
> > 'hosts,bind'.
> >
> > So I'm Still needing some help. Or thus this mean this is not an cUrl
> > problem anymore?
> >
> > Thanks in advance,
> > Tom Van de Putte
> >
> >
> > On Tue, Aug 18, 2009 at 3:40 PM, Tom Van de Putte
> > <goldfrapper_at_gmail.com>wrote:
> >
> >>
> >> Hey,
> >>
> >> My company moved last friday and thus so did our development server. The
> >> problem is that since the relocation my (multi) cUrl script doesn't work
> >> anymore.
> >>
> >> It hangs on curl_multi_select() because it can't resolve the hostname.
> >>
> >> However the CLI of curl works perfectly so I checked the configs (the
> >> development server is an plain (arch)linux - apache - php installation)
> but
> >> they seem clean. If I comment out the direction to our own dns server in
> >> /etc/resolve.conf the CLI version also stops working so I figure out
> that
> >> libcurl/php uses another way to resolve eg. via glibc?
> >>
> >> So I ran the exact same code (simple curl http get action) on another
> >> machine (with almost same configurations) and it works perfectly.
> >>
> >> Using the options CURLOPT_DNS_USE_GLOBAL_CACHE and
> >> CURLOPT_DNS_CACHE_TIMEOUT doe not make any differance.
> >>
> >> Is this problem caused by the fact that our fixed external ip adress
> >> changed or does this have anything todo with curls internal caching or
> ... ?
> >>
> >> I realy need to solve this so any help is welcome!
> >>
> >>
> >>
> >> The test code:
> >>
> >> $_h = curl_init();
> >> curl_setopt($_h, CURLOPT_HEADER, 1);
> >> curl_setopt($_h, CURLOPT_RETURNTRANSFER, 1);
> >> curl_setopt($_h, CURLOPT_HTTPGET, 1);
> >> curl_setopt($_h, CURLOPT_URL, 'http://www.dns.be/' );
> >> curl_setopt($_h, CURLOPT_DNS_USE_GLOBAL_CACHE, false );
> >> curl_setopt($_h, CURLOPT_DNS_CACHE_TIMEOUT, 2 );
> >>
> >> var_dump(curl_exec($_h));
> >> var_dump(curl_getinfo($_h));
> >> var_dump(curl_error($_h));
> >>
> >>
> >>
> > _______________________________________________
> > http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2009-08-18