# apache won't start after upgrade [SOLVED]

## cyclocross

after I got the upgrade and merged the config files, when i try to start or restart I get:

/etc/init.d/apache2 restart

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

Usage: /usr/sbin/apache2 [-D name] [-d directory] [-f file]

                         [-C "directive"] [-c "directive"]

                         [-k start|restart|graceful|graceful-stop|stop]

                         [-v] [-V] [-h] [-l] [-L] [-t] [-S]

Options:

  -D name            : define a name for use in <IfDefine name> directives

  -d directory       : specify an alternate initial ServerRoot

  -f file            : specify an alternate ServerConfigFile

  -C "directive"     : process directive before reading config files

  -c "directive"     : process directive after reading config files

  -e level           : show startup errors of level (see LogLevel)

  -E file            : log startup errors to file

  -v                 : show version number

  -V                 : show compile settings

  -h                 : list available command line options (this page)

  -l                 : list compiled in modules

  -L                 : list available configuration directives

  -t -D DUMP_VHOSTS  : show parsed settings (currently only vhost settings)

  -S                 : a synonym for -t -D DUMP_VHOSTS

  -t -D DUMP_MODULES : show all loaded modules 

  -M                 : a synonym for -t -D DUMP_MODULES

  -t                 : run syntax check for config files

Of course it's not telling me *which* config file has the problem.  Any ideas?

ThanksLast edited by cyclocross on Fri Sep 14, 2007 2:02 am; edited 1 time in total

----------

## RayDude

Did you make sure to do a 'dispatch-conf' or 'etc-update'?

The start script changed for version 2.2.

Raydude

----------

## zeek

I had a similar problem.  I didn't have -D DEFAULT_VHOST set in /etc/conf.d/apache2.

----------

## RayDude

I was missing "Listen *:80" on one install.

But I got a different error message.

Raydude

----------

## cyclocross

I do have -D DEFAULT_VHOST in /etc/conf.d/apache2

I did do a etc-update, but it's possible that i messed that up.  Is there a way to re-merge the config files?

Thanks

----------

## bunder

 *cyclocross wrote:*   

> I do have -D DEFAULT_VHOST in /etc/conf.d/apache2
> 
> I did do a etc-update, but it's possible that i messed that up.  Is there a way to re-merge the config files?
> 
> Thanks

 

if you overwrote the old file, its gone.   :Shocked: 

----------

## cyclocross

I can re-edit the new files if I need to, but I need the new config files to be pulled in.  I tried emerge -C apache,  then re-emerge but it left the config files.  I think my best option is to replace apache and start again.  How can i do that so that it removes the config files as well.

Thanks

----------

## bunder

emerge -C apache

rm -rf /etc/apache

emerge apache

 :Question: 

cheers

----------

## cyclocross

 *Quote:*   

> emerge -C apache
> 
> rm -rf /etc/apache
> 
> emerge apache 

 

This is odd.  After doing the above, I get the same issue:

/etc/init.d/apache2 start

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

Usage: /usr/sbin/apache2 [-D name] [-d directory] [-f file]

                         [-C "directive"] [-c "directive"]

                         [-k start|restart|graceful|graceful-stop|stop]

                         [-v] [-V] [-h] [-l] [-L] [-t] [-S]

Options:

  -D name            : define a name for use in <IfDefine name> directives

  -d directory       : specify an alternate initial ServerRoot

  -f file            : specify an alternate ServerConfigFile

  -C "directive"     : process directive before reading config files

  -c "directive"     : process directive after reading config files

  -e level           : show startup errors of level (see LogLevel)

  -E file            : log startup errors to file

  -v                 : show version number

  -V                 : show compile settings

  -h                 : list available command line options (this page)

  -l                 : list compiled in modules

  -L                 : list available configuration directives

  -t -D DUMP_VHOSTS  : show parsed settings (currently only vhost settings)

  -S                 : a synonym for -t -D DUMP_VHOSTS

  -t -D DUMP_MODULES : show all loaded modules 

  -M                 : a synonym for -t -D DUMP_MODULES

  -t                 : run syntax check for config files

Is there something else that could be installed that would cause this problem?

Thanks

----------

## steveb

Post the content of /etc/conf.d/apache2

// SteveB

----------

## cyclocross

Here's my /etc/conf.d/apache2

# /etc/conf.d/apache2: config file for /etc/init.d/apache2

# When you install a module it is easy to activate or deactivate the modules

# and other features of apache using the APACHE2_OPTS line. Every module should

# install a configuration in /etc/apache2/modules.d. In that file will be an

# <IfDefine NNN> where NNN is the option to enable that module.

# Here are the options available in the default configuration:

#

#  CACHE      Enables mod_cache

#  MEM_CACHE  Enables default configuration mod_mem_cache

#  DAV        Enables mod_dav

#  DEFAULT_VHOST   Enables name-based virtual hosts, with the default

#                  virtual host being in /var/www/localhost/htdocs

#  ERRORDOCS  Enables default error documents for many languages.

#  INFO       Enables mod_info, a useful module for debugging

#  LANGUAGE   Enables content-negotiation based on language and charset.

#  LDAP       Enables mod_ldap (available if USE=ldap)

#  AUTH_LDAP  Enables authentication through mod_ldap (available if USE=ldap)

#  MANUAL     Enables /manual/ to be the apache manual (available if USE=docs)

#  PROXY      Enables mod_proxy

#  SSL        Enables SSL (available if USE=ssl)

#  SSL_DEFAULT_VHOST   Enables default vhost for SSL (you should enable this

#                      when you enable SSL unless you know what you are doing)

#  SUEXEC     Enables running CGI scripts (in USERDIR) through suexec.

#  USERDIR    Enables /~username mapping to /home/username/public_html

#

# Warning: You need one of DEFAULT_VHOST or SSL_DEFAULT_VHOST, otherwise apache

#          will not listen for incomming connections on any port.

APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC SVN_AUTHZ AUTH_PAM"

# Extended options for advanced uses of Apache ONLY

# You don't need to edit these unless you are doing crazy Apache stuff

# As not having them set correctly, or feeding in an incorrect configuration

# via them will result in Apache failing to start

# YOU HAVE BEEN WARNED.

# ServerRoot setting

#SERVERROOT=/usr/lib/apache2

# Configuration file location

# - If this does NOT start with a '/', then it is treated relative to

# $SERVERROOT by Apache

#CONFIGFILE=/etc/apache2/httpd.conf

# Location to log startup errors to

# They are normally dumped to your terminal.

#STARTUPERRORLOG="/var/log/apache2/startuperror.log"

# A command that outputs a formatted text version of the HTML at the URL

# of the command line. Designed for lynx, however other programs may work.

#LYNX="lynx -dump"

# The URL to your server's mod_status status page.

# Required for status and fullstatus

#STATUSURL="http://localhost/server-status"

# Method to use when reloading the server

# Valid options are 'restart' and 'graceful'

# See http://httpd.apache.org/docs/2.2/stopping.html for information on

# what they do and how they differ.

#RELOAD_TYPE="graceful"

----------

## steveb

Well... this is wrong:

```
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC SVN_AUTHZ AUTH_PAM"
```

It should be:

```
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D SVN_AUTHZ -D AUTH_PAM"
```

Try changing it and tell us if this worked?

// SteveB

----------

## cyclocross

Changed it, but same error.   :Crying or Very sad: 

# /etc/conf.d/apache2: config file for /etc/init.d/apache2

# When you install a module it is easy to activate or deactivate the modules

# and other features of apache using the APACHE2_OPTS line. Every module should

# install a configuration in /etc/apache2/modules.d. In that file will be an

# <IfDefine NNN> where NNN is the option to enable that module.

# Here are the options available in the default configuration:

#

#  CACHE      Enables mod_cache

#  MEM_CACHE  Enables default configuration mod_mem_cache

#  DAV        Enables mod_dav

#  DEFAULT_VHOST   Enables name-based virtual hosts, with the default

#                  virtual host being in /var/www/localhost/htdocs

#  ERRORDOCS  Enables default error documents for many languages.

#  INFO       Enables mod_info, a useful module for debugging

#  LANGUAGE   Enables content-negotiation based on language and charset.

#  LDAP       Enables mod_ldap (available if USE=ldap)

#  AUTH_LDAP  Enables authentication through mod_ldap (available if USE=ldap)

#  MANUAL     Enables /manual/ to be the apache manual (available if USE=docs)

#  PROXY      Enables mod_proxy

#  SSL        Enables SSL (available if USE=ssl)

#  SSL_DEFAULT_VHOST   Enables default vhost for SSL (you should enable this

#                      when you enable SSL unless you know what you are doing)

#  SUEXEC     Enables running CGI scripts (in USERDIR) through suexec.

#  USERDIR    Enables /~username mapping to /home/username/public_html

#

# Warning: You need one of DEFAULT_VHOST or SSL_DEFAULT_VHOST, otherwise apache

#          will not listen for incomming connections on any port.

APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC SVN_AUTHZ -D AUTH_PAM"

# Extended options for advanced uses of Apache ONLY

# You don't need to edit these unless you are doing crazy Apache stuff

# As not having them set correctly, or feeding in an incorrect configuration

# via them will result in Apache failing to start

# YOU HAVE BEEN WARNED.

# ServerRoot setting

#SERVERROOT=/usr/lib/apache2

# Configuration file location

# - If this does NOT start with a '/', then it is treated relative to

# $SERVERROOT by Apache

#CONFIGFILE=/etc/apache2/httpd.conf

# Location to log startup errors to

# They are normally dumped to your terminal.

#STARTUPERRORLOG="/var/log/apache2/startuperror.log"

# A command that outputs a formatted text version of the HTML at the URL

# of the command line. Designed for lynx, however other programs may work.

#LYNX="lynx -dump"

# The URL to your server's mod_status status page.

# Required for status and fullstatus

#STATUSURL="http://localhost/server-status"

# Method to use when reloading the server

# Valid options are 'restart' and 'graceful'

# See http://httpd.apache.org/docs/2.2/stopping.html for information on

# what they do and how they differ.

#RELOAD_TYPE="graceful"

----------

## steveb

NO! You did not! At least not all. This is still wrong:

```
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC SVN_AUTHZ -D AUTH_PAM"
```

See that SVN_AUTHZ? Please add an -D infront of it! The full corrected line should be:

```
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D SVN_AUTHZ -D AUTH_PAM"
```

// SteveB

----------

## cyclocross

Thanks SteveB!!!   :Very Happy:   nice catch on the APACHE2_OPTS.

----------

## steveb

 :Very Happy: 

----------

## DancesWithWords

 *steveb wrote:*   

> 

 

Steve got a question for you.  I've slowly address all the problems I've had with my computer, which finally resulted in a complete install.  However I run into a question. I never used vhost in my old installation is it necessary in apache 2.2.6?  If not how and where to I put my old setting to get my system up and running.  I've just finish a fresh clean install of Apache with no changes.  In my old http.conf I had permission/restriction for apache and ServerName mywebsite.com.  Where in the new config files do I put that?  My inclination was to put it in httpd.conf.

--

bruce

----------

