curl-and-php
Re: 'Couldn't resolve host' error since relocating server
Date: Tue, 18 Aug 2009 16:39:02 +0200
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
Received on 2009-08-18