Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 27th August 2009, 15:04
Craig Craig is offline
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.

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


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP code for PHPMyAdmin is not parsed parkerj Installation/Configuration 3 26th May 2009 14:40
ISP Config hesitation when opening web pages frankb Installation/Configuration 7 15th December 2008 14:06
Postfix - Relay access denied gotting Server Operation 3 23rd April 2008 15:06
Email - Ueb-Miau mazhar Installation/Configuration 5 21st December 2005 11:01
The Perfect Setup Suse 9.3 - Postfix problems new_bee05 HOWTO-Related Questions 20 25th November 2005 03:30

All times are GMT +2. The time now is 16:36.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.