# apache run error

## jlanza

I just installed apache but when i go to /etc/init.d/apache2 -k start i get

bash-2.05b# /etc/init.d/apache2 start

 * Starting apache2...

apache2: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

(2)No such file or directory: apache2: could not open error log file /usr/lib/apache2/logs/error_log.

Unable to open logs     

any ideas....

----------

## _never_

Don't assume you can just install and run a webserver and expect it to work the way you want. You need to have a look at /etc/apache2/conf/ first. But maybe you should read some good book about network security first.

----------

## TheRAt

my /usr/lib/apache2/logs dir is a link to /var/log/apache2... Make sure that both the /var/log/apache2 dir and the link to it exist, then try to restart apache2...

----------

## jlanza

* Starting apache2...

apache2: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

----------

## _never_

 *jlanza wrote:*   

> * Starting apache2...
> 
> apache2: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

 

This is because you didn't configure your httpd yet. And this is also why I'm not going to help you. Have a look at /etc/apache2/conf/apache2.conf.

----------

## jlanza

never shut the fuck up man.

I uncommented ServerName localhost in my  /etc/apache2/conf/apache2.conf, now when i start i get

bash-2.05b# /etc/init.d/apache2 start

 * Starting apache2...                                                [ !! ]

....

I try to look at the error log and get this

bash-2.05b# cd /var/log/apache2

bash: cd: /var/log/apache2: Too many levels of symbolic links

bash-2.05b# cat /var/log/apache2

cat: /var/log/apache2: Too many levels of symbolic links

any suggestions anyone?  thanks for the help

----------

## j-m

Set the logs directives to point to /var/log/apache2 or another existing directory - not to symlink symlinked to point to a symlink which points to a symlink which ....  :Rolling Eyes: 

----------

## jlanza

i deleted /var/log/apache2 and created a new directory and it still doesnt work...

----------

## lookinin

You get the same errors?  Post the output of:

```
# ls -l /var/log/apache2 /usr/lib/apache2/logs
```

----------

## jlanza

bash-2.05b# ls -l /var/log/apache2 /usr/lib/apache2/logs

/usr/lib/apache2/logs:

total 8

-rw-r--r--  1 root root    0 Feb 24 02:17 access_log

lrwxrwxrwx  1 root root   16 Feb 23 20:41 apache2 -> /var/log/apache2

-rw-r--r--  1 root root 1470 Feb 24 14:19 error_log

-rw-r--r--  1 root root    0 Feb 24 02:17 ssl_access_log

-rw-r--r--  1 root root  246 Feb 24 14:13 ssl_error_log

-rw-r--r--  1 root root    0 Feb 24 02:17 ssl_request_log

/var/log/apache2:

total 0

----------

## lookinin

 *jlanza wrote:*   

> bash-2.05b# ls -l /var/log/apache2 /usr/lib/apache2/logs
> 
> /usr/lib/apache2/logs:
> 
> total 8
> ...

 

Oops, my bad - I should have said:

```
# ls -ld /var/log/apache2 /usr/lib/apache2/logs
```

But I think I see the problem anyway:

```
# rm /usr/lib/apache2/logs/apache2

# rmdir /var/log/apache2 (or rm /var/log/apache2 if it's a link)

# ln -sf /usr/lib/apache2/logs /var/log/apache2
```

----------

## jlanza

i try to do the first thing...

and

bash-2.05b# rm /usr/lib/apache2/logs/apache2/

rm: cannot remove `/usr/lib/apache2/logs/apache2/': Not a directory

then i try for fun rm -rf and it says the same thing  :Sad: 

----------

## lookinin

 *jlanza wrote:*   

> rm: cannot remove `/usr/lib/apache2/logs/apache2/': Not a directory

 

Leave off the trailing slash... it's not a directory cause it's a symlink  :Smile: 

----------

## jlanza

It still won't start...

i get these errors after unmerging and remerging...

bash-2.05b# /etc/init.d/apache2 start

 * Starting apache2...                                                [ !! ]

 * Apache2 has detected a syntax error in your configuration files:

Syntax error on line 6 of /usr/lib/apache2/conf/modules.d/70_mod_php.conf:

Cannot load /usr/lib/apache2/extramodules/libphp4.so into server: /usr/lib/apache2/extramodules/libphp4.so: cannot open shared object file: No such file or directory

bash-2.05b# /etc/init.d/apache2 start

 * Apache2 has detected a syntax error in your configuration files:

Syntax error on line 57 of /etc/apache2/conf/apache2.conf:

Cannot load /usr/lib/apache2/modules/usr/lib/apache2-extramodules/libphp4.so into server: /usr/lib/apache2/modules/usr/lib/apache2-extramodules/libphp4.so: cannot open shared object file: No such file or directory

bash-2.05b# /etc/init.d/apache2 -k start

 * ERROR:  wrong args. (  -k / -k )

 * Usage: apache2 { start|stop|restart|reload }

 *        apache2 without arguments for full help

----------

## lookinin

 *jlanza wrote:*   

> It still won't start...
> 
> i get these errors after unmerging and remerging...
> 
> 

 

Did you also unmerge mod_php and forget to remerge it?  if you have slocate installed (emerge slocate && updatedb), try:

```
# locate libphp4.so
```

Looks like you got past the log problem, but now it simply can't find mod_php...

All else fails, just emerge mod_php again, even if it's installed:

```
# emerge mod_php
```

----------

## _never_

 *jlanza wrote:*   

> never shut the fuck up man.

 

No problem. I will. But you will never get a well running Apache without configuring it. So have a look at the Apache documentation before asking such dumb questions here.

----------

## jlanza

bash-2.05b# /etc/init.d/apache2 restart

 * Starting apache2...                                                [ !! ]

fixed another thing, but it still wont start....

----------

## jlanza

these are the errors im geting

cat /var/log/apache2/error_log

[Thu Feb 24 22:05:47 2005] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "Guinness"

cat /var/log/apache2/ssl_error_log  

[Thu Feb 24 08:43:58 2005] [error] Server should be SSL-aware but has no certificate configured [Hint: SSLCertificateFile]

[Thu Feb 24 14:13:39 2005] [error] Server should be SSL-aware but has no certificate configured [Hint: SSLCertificateFile]

----------

## lookinin

Regarding the second error, my knowledge of mod_ssl is limited to knowing of its existence, sorry... but a search of the forums should give you some ponters...   As for the first error, this is some sort of hostname issue... probably related to one of your first problems: 

 *Quote:*   

> apache2: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName 

 

Do you have an entry in your /etc/hosts file corresponding to localhost & guinness?  maybe:

```
127.0.0.1       localhost.localdomain localhost

192.168.0.1     guinness.yournetworkname guinness

```

Also check that your /etc/dnsdomainname & /etc/hostname are set:

hostname:

```
guiness
```

dnsdomainname:

```
yournetworkname
```

----------

## _never_

Okay people, I can't watch this anymore. I'll help the kiddy so he stops crying. You need to set the ServerName in your apache.conf like this:

```
ServerName guinness.local
```

If you have something like a DynDNS hostname, use this as your ServerName, like this:

```
ServerName some-host.dyndns.org
```

In most cases, you will just use a combination of your /etc/hostname and /etc/dnsdomainname. Like I told you, go and read the docs and you'll save yourself lots of trouble. At least don't insult me for my opinion about you.

----------

## Cysec

_never_ lose the attitude man, the most powerful aspect of linux is it's community.  No matter who asks the question, nor if the question is what you consider stupid, one should not flame others for asking.  The attitude you take is very similar to that recently received from a tech support analyst by a friend of mine who was dealing with a certain company that would very much like to see the community behind linux crumble.

----------

## _never_

When you search through the forums for my posts, you'll notice that I'm an open and friendly person. But there is one thing I hate. People installing a network service (no matter what kind of) and expect it to work without configuration. This is where most security threats come from - bad maintainance. It is so easy to open up the whole system to the rest of the world with something like Apache. I advised him to read the docs and I did it friendly. I was told to shut up - so I did, until I realized that nobody is going to help him.

This has nothing to do with attitude.

----------

## lookinin

jlanza, just so you know, _never_ is correct, this directive should be set, but in most cases, apache can deduce the domain name via reverse lookup, so if it's in your /etc/hosts, it should figure itself out fine.  See the quote from the apache 2.0 documentation below.  I have an internal http server, and have never bothered to set this directive, but my server is not accessible to the outside world, has only an internal hostname, and, while it may not be technically correct, it works just fine for my needs (extremely light use, some php practice).

 *http://httpd.apache.org/docs-2.0/mod/core.html#servername wrote:*   

> If no ServerName is specified, then the server attempts to deduce the hostname by performing a reverse lookup on the IP address. If no port is specified in the ServerName, then the server will use the port from the incoming request. For optimal reliability and predictability, you should specify an explicit hostname and port using the ServerName directive

 

----------

## lookinin

 *Quote:*   

> until I realized that nobody is going to help him.

 

Oh?  What have I been doing?  Maybe I didn't have his answers right off the bat in each case, but it worked out as far as I can see.Last edited by lookinin on Fri Feb 25, 2005 1:50 pm; edited 1 time in total

----------

## _never_

Sorry, used bad words.

-> Nobody could help him.

Don't take it personally, I'm sorry. =)

----------

## lookinin

 *Quote:*   

> Don't take it personally, I'm sorry. =)

 

No problem, and I'm not taking it personally, just wanted to make it clear that somebody was helping him.

----------

## eXess

Hey girls, private chat in private messages, don't you think? We're not interested. 

About the Apache problem (which was the topic, in case anybody remembers), I'll says that this probably is a dns resolving problem, as _never_ and lookinin said, but I'dd add that IMHO the ServerName _should_ always be set, and the DNS system for the system shoudl also be taken care of. In particular, the name stated as the ServerName should be resolvable either through an entry in /etc/hosts or by asking the DNS servers that need to be set in /etc/resolv.conf. Beware that if you are running a server through a dialup connection with a dyndns hostname - like I am - /etc/hosts is probably the best solution.

----------

## jlanza

i just did all of things and i can still not get the thing to start up

----------

## lookinin

 *jlanza wrote:*   

> i just did all of things and i can still not get the thing to start up

 

Same error or... ?  We'd need a little more information - if it's not giving you any error messages, post the output of this again (or anything else that might help):

```
# tail /var/log/apache2/error_log
```

----------

## jlanza

bash-2.05b$ tail -f /var/log/apache2/error_log

[Thu Feb 24 19:50:49 2005] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "Guinness"

Configuration Failed

[Thu Feb 24 22:04:27 2005] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "Guinness"

Configuration Failed

[Thu Feb 24 22:05:47 2005] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "Guinness"

Configuration Failed

[Fri Feb 25 11:49:11 2005] [notice] Digest: generating secret for digest authentication ...

[Fri Feb 25 11:49:11 2005] [notice] Digest: done

PHP Warning:  Unknown(): Unable to load dynamic library '/usr/lib/extensions/no-debug-non-zts-20020429/java.so' - /usr/lib/extensions/no-debug-non-zts-20020429/java.so: cannot open shared object file: No such file or directory in Unknown on line 0

[Fri Feb 25 11:49:12 2005] [notice] Apache/2.0.52 (Gentoo/Linux) PHP/4.3.10configured -- resuming normal operations

----------

## lookinin

 *Quote:*   

> [Fri Feb 25 11:49:12 2005] [notice] Apache/2.0.52 (Gentoo/Linux) PHP/4.3.10configured -- resuming normal operations

 

Ignoring those errors for the moment, this looks like it's working to me... have you tried connecting?  What URL are you giving it?  If you're using http://localhost, try using http://guiness.yournetwork or http://guiness.

----------

## _never_

 *lookinin wrote:*   

> Ignoring those errors for the moment, this looks like it's working to me... have you tried connecting?  What URL are you giving it?  If you're using http://localhost, try using http://guiness.yournetwork or http://guiness.

 

As long as he doesn't use virtual hosting, the URL is ignored by the server. And even if virtual hosting is enabled, he would get some error (or success) reply from the server.

----------

## lookinin

 *Quote:*   

> As long as he doesn't use virtual hosting, the URL is ignored by the server. And even if virtual hosting is enabled, he would get some error (or success) reply from the server.

 

I see - but would you agree that it seems to be running?  I'm just trying to figure out why he's saying it didn't work.

----------

## _never_

Well, there are alerts. They don't necessarily mean failure to startup, but they could. How about checking ps ax | grep "apache" or /var/run/apache2.pid?

----------

## jlanza

thanks guys, i got everything figured out and it is running fine.  i had to fix some stuff with ssl, now trying to set up phpmyadmin will be the next task  :Smile: .

thanks again

----------

