View Single Post
  #1  
Old 27th August 2009, 15:04
Craig Craig is offline
Member
 
Join Date: Dec 2006
Posts: 56
Thanks: 1
Thanked 3 Times in 1 Post
Default PHP GetHostByName for non-existent domains returns server IP

I can dig from the centos command line and DNS queries for non-existent domains return the expected results, basically nothing.

But, if I use PHP functions, the IP of the server is returned.

Also, if I try to use PHP Pear's HTTPRequest library to fetch a page from a non-existent domain, the root page of the server is again returned.

I haven't tried PHP's cURL yet but I would guess that is the same.

Googling this brings up a number of people who have had the same problem over the years, going back to 2001 but there is NOT ONE SINGLE mention of a solution.

I thought that might mean that those with the problem "simply" reinstalled everything and it all just worked but I tried that, just now, it didn't work.

I'm running Centos 5.3 with ISPConfig v.2 running and other than this PHP problem, it is all working fine.

Any help would be greatly appreciated!

I should add that a dev server running from the same NAT reacts correctly so it seems that it is something in the way the problem server is configured although all the network configuration was done using the GUIs so I don't think it could be a typo or something like that.

I should also add that the IP address returned for non-existent domains is the server's external IP address, as opposed to its internal NAT address. I haven't found anywhere that the server's external IP is in any configuration files so PHP seems to be getting it through DNS one way or another.
__________________
cass-hacks.com

Last edited by Craig; 27th August 2009 at 20:17. Reason: Added information about a second server and External vs. Internal IP address
Reply With Quote
Sponsored Links