# apache :: invalid command LogFormat

## gigel

i've just installed gentoo and i'm very satisfied with it..

but when it comes to apache grrr.

so what is the issue?

i have merged apache(1.3.27) and  mod_php i have edited /etc/apache/conf/apache.conf 

and when i'm about to execute /etc/init.d/apache start this error prevents it from starting...

```
* Starting apache...

Syntax error on line 17 of /etc/apache/conf/apache.conf:

Invalid command 'LogFormat', perhaps mis-spelled or defined by a module not included in the server configuration                                                                          [ !! ]

```

i have commented those lines that contained LogFormat,CustomLog and Alias but after /etc/init.d/apache start still woun't start

```
* Starting apache...

[ !! ]
```

the /etc/init.d/apache script is ok because with a little bit tunnig in the apache.conf(in fact mass options deleting) apache finally starts but when i type lynx http://127.0.0.1 ...404 not found and though index.html is the speciffied path ( /home/httpd/apache -as i set it) 

when i type lynx http://127.0.0.1/index.html the server displays only plain text (and it is not lynx's fault i asure you)

any help will be wellcomed

anyway until now iti is the fastest and more stable distro that i tried

p.s. sorry for the bad english  :Smile: 

----------

## vericgar

LogFormat is part of the log_config module... make sure in the top of the apache.conf with the other LoadModule/AddModule lines, you have the following lines:

LoadModule config_log_module  modules/mod_log_config.so

AddModule mod_log_config.c

Also, if you'll post your apache.conf we could help a lot more  :Wink: 

----------

## gigel

thanx for the answer

in fact it was my mistake because i was putting the LogFormat options after loading the modules...and after i corect that issue apache still would not start

here is the /etc/apache/conf/apache.conf file

```
User apache

Group apache

ServerAdmin black_adormen@linuxmail.org

ServerType standalone

ServerRoot /etc/apache

ServerName http://127.0.0.1

ServerSignature Off

PidFile /var/run/apache.pid

ScoreBoardFile /etc/apache/apache.scoreboard

HostnameLookups Off

DocumentRoot /home/httpd/apache/

##################################################

LoadModule mmap_static_module modules/mod_mmap_static.so

LoadModule env_module         modules/mod_env.so

LoadModule config_log_module  modules/mod_log_config.so

LoadModule agent_log_module   modules/mod_log_agent.so

LoadModule referer_log_module modules/mod_log_referer.so

LoadModule mime_magic_module  modules/mod_mime_magic.so

LoadModule mime_module        modules/mod_mime.so

LoadModule negotiation_module modules/mod_negotiation.so

LoadModule status_module      modules/mod_status.so

LoadModule info_module        modules/mod_info.so

LoadModule includes_module    modules/mod_include.so

LoadModule autoindex_module   modules/mod_autoindex.so

LoadModule dir_module         modules/mod_dir.so

LoadModule cgi_module         modules/mod_cgi.so

LoadModule asis_module        modules/mod_asis.so

LoadModule imap_module        modules/mod_imap.so

LoadModule action_module      modules/mod_actions.so

LoadModule speling_module     modules/mod_speling.so

LoadModule userdir_module     modules/mod_userdir.so

LoadModule proxy_module       modules/libproxy.so

LoadModule alias_module       modules/mod_alias.so

LoadModule rewrite_module     modules/mod_rewrite.so

LoadModule access_module      modules/mod_access.so

LoadModule auth_module        modules/mod_auth.so

LoadModule anon_auth_module   modules/mod_auth_anon.so

LoadModule dbm_auth_module    modules/mod_auth_dbm.so

LoadModule db_auth_module     modules/mod_auth_db.so

LoadModule digest_module      modules/mod_digest.so

LoadModule cern_meta_module   modules/mod_cern_meta.so

LoadModule expires_module     modules/mod_expires.so

LoadModule headers_module     modules/mod_headers.so

LoadModule usertrack_module   modules/mod_usertrack.so

LoadModule example_module     modules/mod_example.so

LoadModule unique_id_module   modules/mod_unique_id.so

LoadModule setenvif_module    modules/mod_setenvif.so

LoadModule vhost_alias_module   modules/mod_vhost_alias.so

###########################################################

ClearModuleList

AddModule mod_mmap_static.c

AddModule mod_env.c

AddModule mod_log_config.c

AddModule mod_log_agent.c

AddModule mod_log_referer.c

AddModule mod_mime_magic.c

AddModule mod_mime.c

AddModule mod_negotiation.c

AddModule mod_status.c

AddModule mod_info.c

AddModule mod_include.c

AddModule mod_autoindex.c

AddModule mod_dir.c

AddModule mod_cgi.c

AddModule mod_asis.c

AddModule mod_imap.c

AddModule mod_actions.c

AddModule mod_speling.c

AddModule mod_userdir.c

AddModule mod_proxy.c

AddModule mod_alias.c

AddModule mod_rewrite.c

AddModule mod_access.c

AddModule mod_auth.c

AddModule mod_auth_anon.c

AddModule mod_auth_dbm.c

AddModule mod_auth_db.c

AddModule mod_digest.c

AddModule mod_cern_meta.c

AddModule mod_expires.c

AddModule mod_headers.c

AddModule mod_usertrack.c

AddModule mod_example.c

AddModule mod_unique_id.c

AddModule mod_so.c

AddModule mod_setenvif.c

AddModule mod_vhost_alias.c

Port 80

Listen 80

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 15

MinSpareServers 4

MaxSpareServers 10

StartServers 4

MaxClients 150

MaxRequestsPerChild 500

# =============================================

Alias /errordocs /home/httpd/errord

Options -MultiViews

AddType text/html .shtml

ErrorDocument 404 /errordocs/404.htm

ErrorDocument 403 /errordocs/404.htm

# =============================================

ScriptAlias /cgi-bin/ "/home/httpd/cgi-bin/"

<Directory "/home/httpd/cgi-bin">

 AllowOverride None

 Options ExecCGI

 Order allow,deny

 Allow from all

</Directory>

# =============================================

LogLevel warn

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t \"%r\" %s %b" common

LogFormat "%{Referer}i -> %U" referer

LogFormat "%{User-Agent}i" agent

CustomLog /var/log/apache/referer_log referer

CustomLog /var/log/apache/agent_log agent

CustomLog /var/log/apache/acces_log combined

ErrorLog  /var/log/apache/error_log

```

and here is what /etc/init.d/apache start is doing

 *Quote:*   

> *Starting apache...                                 [!!]

 

----------

## gigel

now it is really annoying 

```

(graveland)#apachectl configtest

Syntax OK

(graveland)#apachectl start

/usr/sbin/apachectl start: httpd could not be started

```

wtf is wrong??

----------

## gigel

```

wget http://www.apache.org/dist/httpd/apache_1.3.27.tar.gz

tar -zxvf apache*

rm *.gz

cd apache*

./configure --prefix=/bla/bla/bla

make

make install

/bla/bla/bla/bin/apachectl start

httpd started

```

voila!!

it seems to me that the ebuild sucked!!

thanx God the tar.gz from www.apache.org didn't !!!

p.s.after all who needs apache optimization

----------

## vericgar

Sorry about the delayed response, I just rolled out a backup server and have been fixing various glitches and such with it... anyway...

It look liek you fixed things by getting fresh config files from the apache site itself... The first error in the config that you had looks like the ServerName line:

ServerName http://127.0.0.1

ServerName should usually be a hostname, such as:

ServerName psivamp.garjasp.com

(that's an example from my config)

Let us know if you have any other config questions.

----------

## gigel

the ServerName was my mistake,i was in a hurry  :Smile: 

but that was the only error,and apachectl configtest was returning a Syntax OK!!(after correcting the little mystake)

and though apachectl start could not start the httpd...

so the question remains...why apache from apache.org started and why the emerged apache didn't??

i think it was the level of optimisation in the CFLAGS that i used...

now i use O2 and i'm trying to merge apache again...

i'm just not giving up with the optimisation such easily

----------

## sweede

Your problems have nothing to do with the ebuild, in fact the ebuild is quite well built.

When you started apache via /etc/init.d/apache and it failed, the startup script wrote to /mnt/.initd/started  that apache had already been started.

this seems to be a common problem in the startup scripts of gentoo, even if the startup script fails, it will still act like it didnt.

quick fix?

/etc/init.d/apache zap

 *Quote:*   

> (graveland)#apachectl configtest 
> 
> Syntax OK 
> 
> (graveland)#apachectl start 
> ...

 

That right there tells me that apache is more than likely running, or a directory apache is trying to write to does not exist.

the #1 rule with apache is, when in doubt, check the error_logs they will most likely tell you all you need to know

----------

## gigel

well here is /etc/apache/conf/apache.conf

User apache

Group apache

ServerAdmin black_adormen@linuxmail.org

ServerType standalone

ServerRoot /etc/apache

ServerName graveland

ServerSignature Off

PidFile /var/run/apache.pid

HostnameLookups Off

DocumentRoot /home/httpd/htdocs

Port 80

Listen 80

Timeout 300

KeepAlive On

MaxKeepAliveRequests 50

KeepAliveTimeout 15

MinSpareServers 4

MaxSpareServers 10

StartServers 4

MaxClients 50

MaxRequestsPerChild 500

#apachectl configtest

Syntax OK

#/etc/init.d/apache start

starting apache  [ok]

 so it is working

also it's working with apachectl start

no need for /etc/init.d/apache zap

but when i'm changing the /etc/apache/conf/apache.conf file with the one that i've posted earyer in this thread apache can not be started again...

though apachectl configtest says that the syntax is ok!!

so,with the ebuild it's no problem(i'm sure of that)

with the binaries the same..

but with the modules that i try to load it might be a problem ...

[edit]

the error_log does not say anything relevant...

[/edit]

anyway,now i'm in doubt,i have to think twice before running gentoo on a server...on a workstation we all now that it's one of the best solutions  :Wink: 

----------

## sweede

Something is wrong.

the default apache configuration files that Gentoo provides with the ebuild will start and run a HTTP server from /home/httpd/htdocs with no modifications to the config files.

I noticed you do not have Include conf/commonapache.conf  in your apache.conf 

what i would suggest is for you to unmerge apache and move the /etc/apache directory to /etc/apache_old, use ps aux and kill off any and all httpd/apache processes, and then delete /var/logs/apache/* and /home/httpd/*  (backing up any user created, non-apache files)

re-emerge apache, make NO modifications to the config files in /etc/apache/conf

and try to start apache. If this does not work, check the last few lines of /var/log/apache/error_log 

if there is no information in the error log, then i would file a bug  (or search the bugs)

if all goes well, edit your apache.conf , commonapache.conf files, DO NOT REMOVE ANY LINES from the files. use # to comment out entries you dont need. any Directive you wish to change, comment out the default entry and copy the new one with your info. do not comment out the Include conf/commonapache.conf directive

This way you can be sure of what changes you have made and where things go wrong.

----------

## gigel

not a chance...

#apachectl configtest

syntax ok

#apachectl start

apache could not be started

i bet the error comes from the modules section,but i dunno for shure ...

damn thing 

emerge -C apache  :Very Happy: 

----------

## gigel

i just forgot that i had this problem  :Razz: 

i have fixed it,but forget to post the solution

well,if someone else would encounter the same problems as me just put in /etc/make.conf 

CFLAGS="-march=... -O3 -pipe -fomit-frame-pointer"

the last thing(-fomit-frame-pointer) was not there 

...stupid me  :Razz: 

----------

