|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8754 gethostbyname() fails
Submitted: 2001-01-17 03:53 UTC Modified: 2001-09-22 11:38 UTC
From: jonny at 1409 dot org Assigned:
Status: Closed Package: Network related
PHP Version: 4.0.4pl1 OS: Linux 2.2.16 (RH7)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: jonny at 1409 dot org
New email:
PHP Version: OS:


 [2001-01-17 03:53 UTC] jonny at 1409 dot org
When trying to resolv the ip address of a hostname given in /etc/hosts, gethostbyname() works fine. It does NOT work when trying to resolv an ip address which must be looked up via the DNS server though. In the latter case, gethostbyname($hostname) always returns $hostname, i.e. it
behaves like the hostname does not exist. However, doing a command line nslookup, the hostname is found, so it DOES exist.

The problem occurs with version 4.0.4pl1 (compiled on the target system) as well as with version 4.0.1pl2 that comes with RedHat 7.0. I'm using kernel version 2.2.16 and a vanilla (i.e. non-updated) RedHat 7.0.

Thanks in advance...


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-21 21:03 UTC]
Please make sure that you're DNS server is setup correctly
and you have access to it and the internet.  Try running
"netconfig" as root from a prompt.  Also, try running
linuxconf and make sure the order in which hostnames are
setup is correct (i recommend "hosts,dns")

Also, try upgrading to the latest version of PHP.
 [2001-07-22 16:03 UTC]
Ooops, I read that too fast.  Ok, so it works on the command
line, but not in PHP.  Does this still happen in the current
 [2001-08-09 20:38 UTC]
First, update to PHP 4.0.6.
Then try both gethostbyname() and gethostbynamel()
to see if either works.


 [2001-09-22 11:38 UTC]
No feedback, assuming it's fixed

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Jan 22 06:03:34 2022 UTC