hello everyone gld this community exist !
i'm facing new problem with apache2 on ubuntu i'm using lamp from yesterday and everything works fine knowing that i'm originaly from windows !
so when i type gksu service apache2 start in terminal and then put my password, when i refresh localhost on navigtor my site doesn't load, so i type gksu service apache2 sttusi get this

● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Sun 2017-06-11 17:52:48 EEST; 8s ago
  Process: 7418 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

juin 11 17:52:48 christou-development-machine systemd[1]: Starting The Apache HTTP Serv
juin 11 17:52:48 christou-development-machine apachectl[7418]: apache2: Syntax error on
juin 11 17:52:48 christou-development-machine apachectl[7418]: Action 'start' failed.
juin 11 17:52:48 christou-development-machine apachectl[7418]: The Apache error log may
juin 11 17:52:48 christou-development-machine systemd[1]: apache2.service: Control proc
juin 11 17:52:48 christou-development-machine systemd[1]: Failed to start The Apache HT
juin 11 17:52:48 christou-development-machine systemd[1]: apache2.service: Unit entered
juin 11 17:52:48 christou-development-machine systemd[1]: apache2.service: Failed with 

then i try this to find the error journalctl | apache2 i get this

 AH00111: Config variable ${APACHE_RUN_DIR} is not defined
apache2: Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir takes one argument, Common directory for run-time files (shared memory, locks, etc.)
christou@christou-development-machine:~$ gksu service apache2 status
christou@christou-development-machine:~$ journalctl | apache2
[Sun Jun 11 18:07:25.165228 2017] [core:warn] [pid 7665] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
apache2: Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir takes one argument, Common directory for run-time files (shared memory, locks, etc.)

so when i open my config my config page in line 80 i really don't what to do with it this wht is in line 80 DefaultRuntimeDir ${APACHE_RUN_DIR}

Dani AI

Generated

The AH00111 message means Apache parsed the config before the APACHE_RUN_DIR variable was available. On Ubuntu/Debian, that variable normally comes from /etc/apache2/envvars and is referenced in apache2.conf using the ${VAR} syntax. Apache replaces ${VAR} with either a value set via the Define directive or with an environment variable present at startup; if nothing is set, you get the warning and the runtime-dir directive fails. See Configuration files: variable substitution and DefaultRuntimeDir.

Quick way to get unstuck without reinstalling:

  • Start/inspect the service the systemd way (skip gksu):
    sudo systemctl restart apache2
    sudo journalctl -u apache2 -b | tail -n 50
  • Make sure envvars is actually being loaded. You should see apachectl or an EnvironmentFile line:
    systemctl cat apache2
  • If the variable is still not seen, define it explicitly at the very top of /etc/apache2/apache2.conf, then test and restart:
    Define APACHE_RUN_DIR /run/apache2
    sudo apachectl configtest
    sudo install -d -m 755 -o root -g root /run/apache2
    sudo systemctl restart apache2

    Define is intended for config-time variables used as ${VAR}. It overrides shell env values, which is fine here. See Define.

Notes based on the thread: ’s question is on point; verify APACHE_RUN_DIR exists and is writable. is right about envvars being the source; also double-check that file was not edited with Windows line endings, which can break sourcing. If you truly want a clean slate, back up /var/www first, then purge and remove leftovers:

sudo apt purge 'apache2*'
sudo rm -rf /etc/apache2 /var/lib/apache2 /var/log/apache2

Recommended Answers

All 12 Replies

What's APACHE_RUN_DIR set to? It will be defined elsewhere in your config

${APACHE_RUN_DIR} should be defined in /etc/apache2/envvars, now I don't have one to verify, but it should be something like:

export APACHE_RUN_DIR=/var/run/apache2$SUFFIX

this is the line 80 of apache2.conf DefaultRuntimeDir ${APACHE_RUN_DIR}this is alla what i found in line 80 what can i do with it.
i checked the envvas too i find in line 20 this export APACHE_RUN_DIR=/var/run/apache2$SUFFIX

i'm really stuck here all your help be apraciated

Just a guess. Look at the source envars noted at

the link you gave me i have been on before none of that gave answer so i posted here!
conclusion now i want to remove apache2 but to install new hopping that will install without problem but the folder apache2 remain with everything i'm using sudo apt-get remove apache*
is there i way to remove apache2 completly and make my pc forget it for ever ??

@chris. I'm not there to dive into your apache but the answer there looked good. That doesn't mean it is the answer to this one.

FIRST, never assume your files are going to survive. Why folk haven't learned this lesson is a mystery. If you have pages or folders you want safe, then copy those to backups.

SECOND. Try the LAMP install steps at It's more than the single apt-get you wrote here.

Member Avatar for Member #120589

Sorry maybe not a fix but xampp for Linux is a handy download and easier than installing separate components manually.

is there i way to remove apache2 completly and make my pc forget it for ever ??

Yes, you can run:

sudo dpkg --purge apache2

This however will not remove the default document root (usually /var/www/html/) as the installation writes the welcoming apache frontpage.

i know how to install it but how to remove everything of apache2 but using sudo apt-get remove apache* everything remain the same nothing change the apache2 folder is still on my computer do i have to reinstall ubuntu to start everything again !??

doing this code journalctl | apache2 in terminal i get this as result

//this is the error message i get 
AH00111: Config variable ${APACHE_RUN_DIR} is not defined
apache2: Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir takes one argument, Common directory for run-time files (shared memory, locks, etc.)

i oppened apache2.conf so in line 80 this is what i found DefaultRuntimeDir ${APACHE_RUN_DIR} i checked also the envarrs file and this is what is in

# /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$SUFFIX/apache2.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

@chris. If you want to remove the apache2 directory why didn't you remove it. Your choice of rm or GUI.

As to know how to install it, you shared only 1 of the 3 install commands. I see the purge command was shared along with xampp.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.