# Apache - problems getting it working

## bryon

looked to the desktop configuration for help to get apache and php and ssl working.  I did  what the doc said and now when i do 

 *Quote:*   

> 
> 
> bash-2.05b# /etc/init.d/apache start
> 
>  * Starting apache...                                                     [ !! ]
> ...

 

it does not work at all.  Any sugestions, please

----------

## sdsheeks

Please run apachectl configtest and post your results here.

----------

## pjp

Moved from Portage & Programming

----------

## bryon

when i run i get 

 *Quote:*   

> 
> 
> root@lappy bab # apachectl configtest
> 
> Syntax OK
> ...

 

----------

## sdsheeks

post your apache.conf file here....i'll take a look at it.  You might want to try apachectl start to see if that gives you any error messages...

Dave

----------

## bryon

well the thing is i relly did not change much in the apache.conf all i renemnber changing is the domain name.  but here it goes

 *Quote:*   

> 
> 
> # $Header: /home/cvsroot/gentoo-x86/net-www/apache/files/conf/apache.conf,v 1.2 2002/05/04 23:23:01 woodchip Exp
> 
> $
> ...

 

and the apachectl start

 *Quote:*   

> 
> 
> root@lappy conf # apachectl start
> 
> /usr/sbin/apachectl start: httpd could not be started
> ...

 

----------

## MoonWalker

Take a look at apache log files, they may give you some clue and what version of apache are you using, 1 or 2?

btw, have you tried to comment out your change of servername? I have some memory of it cousing trouble to be set there. You may better set it in a virtual host.

----------

## bryon

i trited commenting out and still it did not work.  The server is not starting up someting is stopping it from starting up. And I am running version 1.3.27-r3

----------

## zentek

Same problem here, the logs arnt that usefull too. Here is what i have in error_logs

```
 

[Tue May  6 06:16:58 2003] [alert] mod_unique_id: unable to gethostbyname("gatemaster.zentekonline.com")

```

My apache.conf have the servername in it. Ill try to set up a DNS record for gatemaster but i never had to do it in the past.I have the same type of config as bryon and exacly the same problem. I am still investigating the issue.

----------

## vericgar

The issue is that the unique_id module uses the IP address of the ServerName to generate a unique id for each request. If it can't resolve the ServerName to an IP address then it will barf. There are 2 solutions:

1) add a line to the /etc/hosts file so that ServerName resolves to an IP address

2) review the features of mod_unique_id http://httpd.apache.org/docs/mod/mod_unique_id.html and see if you really need it. If you don't, then comment out the following 2 lines:

LoadModule unique_id_module modules/mod_unique_id.so 

AddModule mod_unique_id.c

----------

## dgrant

I"m having this exact same problem as the original poster.  My ServerName is set to localhost and localhost is in /etc/hosts file, set to 127.0.0.1...

I basically haven't changed anything in the /etc/apache/apache.conf file, all I did was change the ServerName.  I've tried commenting it out, and that doesn't work either.

----------

## dgrant

to add to my last comment:

When I have a fresh install and ServerName is commented out, I get this:

```

 * Starting apache...

[Thu May 29 12:23:48 2003] [alert] apache: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName                   [ !! ]

```

When I change the ServerName to localhost or gentoo, or whatever, I get this:

```

 * Starting apache...                                                     [ !! ]

```

This is what I see in the error_log:

```

[Thu May 29 12:25:11 2003] [alert] mod_unique_id: unable to gethostbyname("gento

o")

```

When I comment out the mod_unique_id stuff, the apache works.  But localhost/127.0.0.1 is in my /etc/hosts file...so I don't see why this won't work.  I'll look at the link that you have provided vericgar later.  Thanks.[/code]

----------

## nickp

I have exactly the same error! I hope someone knows a solution.

Nick  :Rolling Eyes: 

----------

## dgrant

Commenting out the unique_iq lines in /etc/apache/conf/apache.conf seems to work.  I'm not sure what unique_id stuff is for.  It sounds like just some security measure....  who cares about security.   :Smile: 

----------

## fjor

I had the same problem but there wasn't any need to mess with unique_id stuff.

1)  Try setting your hostname in the file /etc/hostname, ie.  the file will just contain:

                 <your hostname>

2)  Then edit your /etc/hosts file such that:

              127.0.0.1      <your hostname>

               <your ip>    <your domain>   <your hostname>

     Yes, replace the "localhost" with <your hostname>.

3)  In /etc/apache/conf/apache.conf, set the ServerName to <your hostname>

Hope this helps!     :Smile: 

fjor

----------

## H0bb3z

You can have multiple names on a single line in /etc/hosts:

```
127.0.0.1  localhost  mycomputername.domain.com  mycomputername
```

Try to have an entry in hosts to match what is in /etc/hostname

----------

## paranode

 *dgrant wrote:*   

> It sounds like just some security measure....  who cares about security.  

 

Oh goodness, please don't be serious!   :Very Happy: 

Gentoo users aren't Windows users!

----------

## H0bb3z

 *bryon wrote:*   

> looked to the desktop configuration for help to get apache and php and ssl working.

 

Did you run:

```
ebuild /var/db/pkg/dev-php/mod_php-x.y.z/mod_php-x.y.z.ebuild config

ebuild /var/db/pkg/net-www/mod_ssl-x.y.z/mod_ssl-x.y.z.ebuild config
```

I didn't see the following in the loadmodules section of apache.conf:

```
<IfDefine PHP4>

LoadModule php4_module    extramodules/libphp4.so

</IfDefine>

<IfDefine SSL>

LoadModule ssl_module    extramodules/libssl.so

</IfDefine>
```

and I didn't see the following in the addmodules section of apache.conf:

```
<IfDefine PHP4>

AddModule mod_php4.c

</IfDefine>

<IfDefine SSL>

AddModule mod_ssl.c

</IfDefine>
```

Make sure you update /etc/conf.d/apache by uncommenting:

Set APACHE_OPTS="-D SSL -D PHP4"

Oh yeah, and make sure you've emerged php, mod_php, and mod_ssl

----------

## billatq

I'm having the same damn problem. If mod_php is properly set up, apache silently fails to load. It seems to work fine by itself and with mod_ssl however. If it's the 1.3.x series, it fails, the 2.x series, it segfaults. I've tried a couple of different versions to no avail. Defining the server's name in /etc/hosts, along with removing the unique module has no effect.

----------

## H0bb3z

As long as you have the code in apache.conf (listed in my last post above) to load the mod_php module and you pass apache -D PHP4 in the startup script, it should load, unless there is a problem with mod_php.

I had a similar problem at some point.  I think I unmerged mod_php and then emerged php and mod_php and things worked.

----------

## jimlynch11

 *fjor wrote:*   

> I had the same problem but there wasn't any need to mess with unique_id stuff.
> 
> 1)  Try setting your hostname in the file /etc/hostname, ie.  the file will just contain:
> 
>                  <your hostname>
> ...

 

thanks fjor, i think it got apache running

now where do i put the files? i tried the /home/httpd directory, but got a 404 File Not Found...

[EDIT]: put it in the /home/httpd/htdocs directory and all was well and good! thanks!

----------

## macx11

If you followed fjor's instructions and are still stuck... Type in the following:

```
cat /etc/hostname ; echo $HOSTNAME
```

They should be the same. This is set when the system boots and is were Apache pulls the hostname from. So to fix it type: (NOTE: you do not have to do this after your next restart)

```
export HOSTNAME=<your hostname>
```

Now try the top code again. If it works, use 

```
apachectl start
```

 to start Apache's httpd.

----------

## Monkfish

 *macx11 wrote:*   

> If you followed fjor's instructions and are still stuck... Type in the following:
> 
> ```
> cat /etc/hostname ; echo $HOSTNAME
> ```
> ...

 Did that, but I'm still getting the same issue.

----------

## brkdncr

I'm having the same issue as the original poster, any more clues?

here is the exact message:

```
bash-2.05b# apachectl start

[Sat Aug  2 18:14:57 2003] [alert] apache: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
```

----------

## dma

Wait... you aren't on the internet?

I had a similar problem with Net::IRC for perl.   :Embarassed: 

Setting your hostname's IP address to 127.0.0.1 (in /etc/hosts) resulted in SERIOUS problems for me.

----------

## billatq

Following my post on this a couple months ago, I uninstalled gentoo and re-installed FreeBSD (obscure cpu error that rendered python unusuable until I found a replacement cpu) and then re-installed gentoo after the cpu was replaced. I ran into this same problem, but found that it's related to one of the use variables that mod_php is compiled with. Apparently apache doesn't like it. My solution for now was to do an emerge -pv, see what variables it uses and then deselected all of them. Presto! mod_php works. Hope this helps someone else.

----------

