How do I fix this syntax error:
AH00526: Syntax error on line 4 of /etc/apache2/envvars:
Invalid command 'unset', perhaps misspelled or defined by
a module not included in the server configuration
Background:
I get an error at every startup. I think it is related to this issue, same errors:
Why is my Apache not working after upgrading to Ubuntu 14.04?
$ cat apport.log.1
ERROR: apport (pid 2081) Tue Dec 16 10:09:06 2014: called for pid 22820, signal 11, core limit 0
ERROR: apport (pid 2081) Tue Dec 16 10:09:06 2014: executable: /usr/sbin/apache2 (command line "/usr/sbin/apache2 -k start")
ERROR: apport (pid 2081) Tue Dec 16 10:09:06 2014: is_closing_session(): no DBUS_SESSION_BUS_ADDRESS in environment
ERROR: apport (pid 2081) Tue Dec 16 10:09:09 2014: wrote report /var/crash/_usr_sbin_apache2.0.crash
It seems odd that only one person mention envvars file. All the undefined vars are there, so the question I have is why envvars not loaded or is it being loaded too late?
I added
Include envvars
to /etc/apache2/apache2.conf@57 (before Mutex line) and reran
/usr/sbin/apache2 -k start
as seen in the log (I know this method of starting apache is deprecated; I don't know what script calls this (I presume /usr/sbin/apache2
), but I need apport to stop choking on it because it is preventing other subsequent scripts from running) and I get a syntax error which I think is the source of the problem:
AH00526: Syntax error on line 4 of /etc/apache2/envvars:
Invalid command 'unset', perhaps misspelled or defined by
a module not included in the server configuration
So what is the fix for this syntax error?
Ubuntu 14.04 (3.13.0-43-generic) Server version: Apache/2.4.7 (Ubuntu) apport-cli -v 2.14.1
UPDATE: Here is my envvars file. I think it all stock.
# envvars - default environment variables for apache2ctl
# this won't be correct after changing uid
unset HOME
# for supporting multiple apache2 instances
if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
else
SUFFIX=
fi
# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment variables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
# temporary state file location. This might be changed to /run in Wheezy+1
export APACHE_PID_FILE=/var/run/apache2/apache2$SUFFIX.pid
export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
# Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.
export APACHE_LOG_DIR=/var/log/apache2$SUFFIX
## The locale used by some modules like mod_dav
export LANG=C
## Uncomment the following line to use the system default locale instead:
#. /etc/default/locale
export LANG
## The command to get the status for 'apache2ctl status'.
## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
#export APACHE_LYNX='www-browser -dump'
## If you need a higher file descriptor limit, uncomment and adjust the
## following line (default is 8192):
#APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'
## If you would like to pass arguments to the web server, add them below
## to the APACHE_ARGUMENTS environment.
#export APACHE_ARGUMENTS=''
## Enable the debug mode for maintainer scripts.
## This will produce a verbose output on package installations of web server modules and web application
## installations which interact with Apache
#export APACHE2_MAINTSCRIPT_DEBUG=1
source /etc/apache2/envvars
instead of include it in apache configuration file. If you want you could add/etc/apache2/envvars
in your question, so we can help you to find out errors.