GrepBoard/Manuals
605 manuals ·

Apache AH00111: Config variable ${APACHE_RUN_DIR} is not defined

·Tested on Ubuntu 24.04 (Docker) · Apache 2.4.58 · 2026-10·Test scope ↓·4 steps

AH00111 Config variable ${APACHE_RUN_DIR} is not defined: apache2 was run directly on Ubuntu and skipped envvars. Use apache2ctl with the same options.

output
AH00111: Config variable ${APACHE_RUN_DIR} is not definedapache2: Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot

Apache on Ubuntu or Debian was started through the apache2 binary itself, so the variables the configuration relies on (/etc/apache2/envvars) were never loaded. The configuration is not broken. Pass the same options to apache2ctl instead (apache2 -t → apache2ctl -t).

[1] Check how you ran it. This is an Ubuntu 24.04 container with only the apache2 package installed, tested through the binary:

console
# apache2 -t
output
[Tue Oct 27 03:54:52.486008 2026] [core:warn] [pid 2940] AH00111: Config variable ${APACHE_RUN_DIR} is not definedapache2: Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot

AH00111 itself is only a warning. The check stopped on the next line, where DefaultRuntimeDir received the literal text ${APACHE_RUN_DIR} instead of a path. Because it stops at the first error, other variables such as APACHE_LOCK_DIR and APACHE_RUN_USER do not show up here, but they are just as empty. apache2 -k start failed with the same two lines.

[2] Test again with apache2ctl, which loads envvars before calling apache2.

console
# apache2ctl -t
output
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.0.2.10. Set the 'ServerName' directive globally to suppress this messageSyntax OK

Syntax OK means the configuration is fine. The AH00558 line is an unrelated warning (see AH00558 ServerName). The variables live in envvars:

console
# grep -E "APACHE_RUN_DIR|APACHE_LOCK_DIR|APACHE_LOG_DIR" /etc/apache2/envvars
output
export APACHE_RUN_DIR=/var/run/apache2$SUFFIXexport APACHE_LOCK_DIR=/var/lock/apache2$SUFFIXexport APACHE_LOG_DIR=/var/log/apache2$SUFFIX

Debian's README.Debian says the same: this layout uses environment variables, so calling /usr/bin/apache2 directly will not work with the default configuration, and any options meant for apache2 should be given to apache2ctl instead. The bad user name ${APACHE_RUN_USER} entry in the same document's troubleshooting list has the same cause.

[3] If you really need the binary (for debugging, say), load envvars in the same shell first.

console
# source /etc/apache2/envvars && apache2 -t
output
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.0.2.10. Set the 'ServerName' directive globally to suppress this messageSyntax OK

Running it in a different shell, as with sudo apache2 …, does not carry the loaded variables over, so do this inside a root shell or use apache2ctl.

[4] If the variable name does not start with APACHE_, the cause is different: a variable written into your own configuration that is defined nowhere. In that case apache2ctl -t only warns and still passes.

console
# apache2ctl -t
output
[Tue Oct 27 03:54:52.661489 2026] [core:warn] [pid 2971:tid 130752735975296] AH00111: Config variable ${SITE_ROOT} is not definedAH00112: Warning: DocumentRoot [/etc/apache2/${SITE_ROOT}] does not exist…Syntax OK

Per the Apache docs, an unknown variable is left in place as the literal ${VAR} and a warning is logged. That is how DocumentRoot became the nonexistent /etc/apache2/${SITE_ROOT}. Reloading on the strength of Syntax OK leaves that site pointing at a folder that does not exist. Define the variable inside the configuration with Define:

/etc/apache2/conf-available/site-vars.conf
Define SITE_ROOT /srv/site

Enable it with a2enconf site-vars, then check the defined values:

console
# apache2ctl -D DUMP_RUN_CFG 2>&1 | grep -iE "Define|ServerRoot"
output
ServerRoot: "/etc/apache2"Define: DUMP_RUN_CFGDefine: SITE_ROOT=/srv/site

With Define in place, AH00111 and AH00112 disappeared from apache2ctl -t. The docs say Define takes precedence over shell environment variables, and only environment variables defined before the server starts can be used. To manage the value as an environment variable instead, add an export line to envvars.

Analyze your Apache log in the browser ↗ — nothing is uploaded.

#apache#apache2ctl#envvars#ubuntu