cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

'Couldn't resolve host' error since relocating server

From: Tom Van de Putte <goldfrapper_at_gmail.com>
Date: Tue, 18 Aug 2009 15:40:25 +0200

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