This particular error bears the error code AH00111 which comes from line number 1227 of the /server/core.c
file which reads case USE_CANONICAL_NAME_UNSET:
. The comment written about USE_CANONICAL_NAME
says – “With UseCanonicalName on (and in all versions before 1.3) Apache will use the hostname and port specified in the ServerName directive to construct a canonical name for the server. (If no port was specified in the ServerName directive, Apache uses the port supplied by the client if any is supplied, and finally the default port for the protocol used.”
This usually means that there was some wrong sequence of instruction towards Apache during some process such as enabling or disabling a module or improper file permission of the person executing the command. In Debian based system, there can be some fault in the module which resulted in the wrong sequence of loading of environment variables. As a result, the apache.conf
file can be opened by Apache but Apache can not understand the instructions or settings. Although the error appears to be innocent, it can lead to dysfunction of the files located at sites-enabled
. In other words – your site may fail to load if you poke Apache before fixing the error. To avoid this kind of odd error, on our website, you will find this kind of instruction in various guides:
1 2 3 4 | # configtest and graceful restart apachectl configtest /etc/init.d/apache2 reload # sudo service apache2 restart |
This means, running apachectl configtest
and /etc/init.d/apache2 reload
commands as root user on a live server when required. The command sudo service apache2 restart
commented out to mean “you know what you are doing”.
---
Steps to Fix Config variable ${APACHE_RUN_DIR} is not defined Error
Essentially we should try to run Apache via the /etc/init.d/apache2
start/stop script, the script is supposed to export all environment variables needed, from /etc/apache2/envvars
. Other commands will directly interact with the binary. The /etc/apache2/envvars
file contains the line:
1 | export APACHE_RUN_DIR=/var/run/apache2$SUFFIX |
You can run this command to check whether that line is present or not:
1 | cat /etc/apache2/envvars | grep APACHE_RUN_DIR |
If present and you are lucky then running one command will fix the problem:
1 2 3 4 5 6 7 8 | source /etc/apache2/envvars # tests and reload apache2 -S apachectl configtest # if OK then try to reload /etc/init.d/apache2 reload # again check /usr/sbin/apache2 -V |
If your luck is not that great then try:
1 2 | sudo apache2ctl startInvoking 'systemctl start apache2'. sudo apache2ctl status |
If still throws error then the issue is complicated and needs your investigation.