While configuring my Apache on Debian10, I was confronted with this error bellow, this issue also can happen in all Debian based Servers like Ubuntu Systems.
Symption:
root@www:/etc/ssl/osradar# apache2 -t
[Fri Feb 07 14:47:18.945268 2020] [core:warn] [pid 21383] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
apache2: Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot
Solutions:
Method 1
You should use the apachectl or apache2ctl script to start apache
root@osradar:~$ sudo apache2ctl startInvoking 'systemctl start apache2'.
root@osradar:~$ sudo apache2ctl stop
Method 2
The variable APACHE_RUN_DIR is defined in /etc/apache2/envvars. load (source) the environment before runningapache2`.
root@osradar:~$ source /etc/apache2/envvars
root@osradar:/home/lautturi$ /usr/sbin/apache2 -V
Server version: Apache/2.4.38-3+deb10u3
if this works for you please share this solution!
For me:
The first method does not work
The second method works into this time:
a) restart apache
b) edit configuration files
then the second method must be repeated