conflicting gethostbyname behaviors

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I seem to be getting conflicting gethostbyname behavior on different
servers.  Before going into detail, here's the script I'm using:

$rev = implode('.',array_reverse(explode('.', $address)));

$lookup = "$";
echo gethostbyname($lookup);
echo '<br />';
echo $lookup;

On server A, the output I get is as follows:

On server B, the output I get is this:

As I understand it, server A's output is the correct output - not
server B's.

Server A is running PHP Version 4.4.1 with Apache/1.3.34 while server B
is running PHP Version 4.3.11 with Apache/2.0.52.  I'd like the above
script, however, to work just as well on server A as it does on server

Any ideas as to how I might go about doing this or what the problem is?
 Any help would be appreciated - thanks!

Re: conflicting gethostbyname behaviors

yawnmoth wrote:

Quoted text here. Click to load it


Did one of them change recently their name maybe?
PHP caches lookups. (Or rather Apache does if I understand it well).

What MIGHT help are some usercontributed notes on

Two possibilities:
1) restart Apache (in case of caching DNS-problem)
2) Do not use gethostbyname, but use 'dig' instead.

Just go to and look up the function for details.

Erwin Moller

Site Timeline