LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Apache not starting properly -- "unable to gethostbyname" (https://www.linuxquestions.org/questions/linux-newbie-8/apache-not-starting-properly-unable-to-gethostbyname-172291/)

ColoRambler 04-19-2004 09:13 PM

Apache not starting properly -- "unable to gethostbyname"
 
Hello,

I use Linux (SuSE 8.1) on my home computer to develop a personal Web site. After a change in ISPs (I changed from DSL to a major cable provider), I've been having some difficulty getting Apache up and running. Whenever I try to start Apache, I get a message like this in the error log:

[Mon Apr 19 19:37:33 2004] [alert] mod_unique_id: unable to
gethostbyname("x1-6-00-03-47-39-f7-ad")

and Apache doesn't start.

I've noticed that this strange name ("x1-6-00-03-47-39-f7-ad") has shown up elsewhere, such as my default command line prompt, but I haven't been able to change it to something more appetizing to Apache. I've looked at httpd.conf and tried setting ServerName to 127.0.0.1 (i.e. localhost) rather than a specific host name, without any luck.

I'd appreciate any advice anyone may have in resolving this.

Thanks,
ColoRambler

ToniT 04-19-2004 09:46 PM

That thing is either written to your /etc/hostname or assigned by the dhcp client.
Either way, hostname of your computer should be resolvable; there might be some problem with the domain search patch in /etc/resolv.conf.

Other way to fix the problem is to put a proper line to /etc/hosts, something like
Code:

127.0.0.1 nicenameyoulike localhost x1-6-00-03-47-39-f7-ad
. Or you can deny dhcp client to change your hostname in the first place.

ColoRambler 04-20-2004 09:10 PM

Adding a line like that to the hosts file worked like a charm. Thanks for the tip!

ColoRambler

mreyes 04-22-2004 11:31 AM

Hi, I tried that line and it worked but once I restarted the server it gave me
unable to gethostbyname("")

Any ways to solve this?

ToniT 04-22-2004 11:39 AM

What does the 'hostname' command says? Does
Code:

host `hostname`
work?

mreyes 04-22-2004 11:50 AM

Hi,

my HOSTNAME file says "debian" on it. Shouldn't that show up with the unable to gethostbyname("") error? Instead it just gives me a blank hostname.

ToniT 04-22-2004 11:59 AM

It should. What does the hostname command says?

mreyes 04-22-2004 12:08 PM

Hi,

the hostname command line trick worked. Thanks!

Nirbo 04-24-2004 11:49 PM

Just posting to say thanks :D This worked for me in FreeBSD 4.9-STABLE

I've never had any troubles with FreeBSD 5.2.1 and Apache 2.0.49... but this was my first runs with FreeBSD 4.9, and Apache 1.3.29 :O


All times are GMT -5. The time now is 10:14 AM.