[aman@aman-Inspiron-1440:~$ apache2
[Mon Apr 21 17:36:38.019213 2014] [core:warn] [pid 4134] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Mon Apr 21 17:36:38.019345 2014] [core:warn] [pid 4134] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Mon Apr 21 17:36:38.019370 2014] [core:warn] [pid 4134] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Mon Apr 21 17:36:38.019385 2014] [core:warn] [pid 4134] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Mon Apr 21 17:36:38.019414 2014] [core:warn] [pid 4134] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon Apr 21 17:36:38.028756 2014] [core:warn] [pid 4134] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon Apr 21 17:36:38.029032 2014] [core:warn] [pid 4134] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon Apr 21 17:36:38.029056 2014] [core:warn] [pid 4134] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}

This is the content of /etc/apache2/apache2.conf file.


8 Answers 8


I had this problem even though apache was working for me. I simply wanted to do a quick

$ /usr/sbin/apache2 -V

to find the value of SERVER_CONFIG_FILE. Because that's not the way to start apache2 any more it fails with the errors the OP posts. A quick and dirty workaround is simply to set the envvars that are missing first:

$ source /etc/apache2/envvars
$ /usr/sbin/apache2 -V

This sets the APACHE_LOCK_DIR variable and all is well (-D SERVER_CONFIG_FILE="apache2.conf").

  • 1
    This worked for me. Same issue, Apache was running and operating, yet running apache2 -S failed. All fixed.
    – Twisty
    Commented Mar 15, 2016 at 21:26
  • Strange. This didn't seem to work for me. It makes sense as to why it should though. Commented May 18, 2016 at 22:53
  • @TylerCrompton - How did it fail? What was the error?
    – lane
    Commented May 19, 2016 at 7:06
  • It didn't make any difference. I was still experiencing the issue that OP had. Running apache2 as root fixed the problem though. Commented May 19, 2016 at 7:11
  • 4
    An easier alternative: apache2ctl -V Commented Jun 16, 2016 at 19:25

I had this problem : The cause is in the file


where the root have changed:

before upgrade = /var/www
after upgrade = /var/www/html

So edit to modify this file

sudo gedit /etc/apache2/sites-available/000-default.conf

And restart apache

sudo service apache2 restart
  • As this is a problem the OP might face, this is not the problem he is having at this moment. Either case, as I explained in this answer, I don't recommend editing the 000-default.conf file.
    – Dan
    Commented Apr 21, 2014 at 12:41
  • Its working after moving to /var/www/html Commented Apr 21, 2014 at 12:51
  • 2
    +1 I couldn't figure this out either. You're the man!
    – gion_13
    Commented Apr 24, 2014 at 11:32
  • 2
    In my case I'm still having this issue and the html subfolder already exists, which in my case is actually irrelevant since all my sites use VirtualHosts
    – jhbsk
    Commented Feb 25, 2015 at 12:22
  • 4
    This cannot be the answer! The error above is unrelated to the DocumentRoot setting. Commented Jun 16, 2016 at 19:18

Symptoms and solution

In many Q&A web sites or forums, people confuse symptoms and actual causes. I just upgraded a ubuntu server from 13.10 to 14.04.1 and ran into the exact same symptoms described by the OP, including:
1- apache apparently not working. 2- apache configuration variable undefined. 3- the syntax error mentioned by the OP.

The problem is that not all of these symptoms are actually germane to the actual problem and they only serve as a distraction to those who try their best to help.

Different root problems may cause administrators to come to sites like this one with roughly the same description: "I upgraded the OS and now apache is not working..."

One specific cause

Having all the exact same apparent symptoms as the OP, I was attracted to this question. Unfortunately, the only answer that contained a valid hint to the real root cause of my problem was downvoted (-1), posted by user1469291 with a rep of 1!! So I searched further other web sites until I found a clear explanation of the problem (and thereby of the solution).

The solution that follows may not solve the OP's real problem, but I'm sure that it'll help others who may be attracted to this question for the same reasons as I was.

/etc/apache2/apache2.conf contains:

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

which means that only site configuration files in /etc/apache2/sites-enabled/ ending in .conf will get loaded. Older symlink in that directory will be ignored.

It used to be simply sites-enabled/*. That's why all my virtual host configuration files that I simply named ww1.example.com, ww2.example.com, etc, used to work but suddenly and initially inexplicably stopped working after the upgrade.

So, either change the directive above and reload apache, or, like I did, manually remove all the older symlinks in sites-enabled/, rename all the files in sites-available/ to add the suffix .conf and then re-enabled each site individually.

In addition, the default directive in apache.conf are stricter:

<Directory />
  Options FollowSymLinks
  AllowOverride None
  Require all deny
<Directory /var/www/>
  Options Indexes FollowSymLinks
  AllowOverride None
  Require all granted

So if you host your virtual sites in /home/user/somewhere, make sure to override the directive appropriately.

  • 1
    This is a good answer. Best to understand the changes before rushing in and complaining that things don't work right. Commented Sep 24, 2014 at 22:29
  • 1
    Thanks for this, I didn't realise renaming the file didn't remove the symlink from sites-enabled.
    – Benno
    Commented Jan 1, 2015 at 2:28
  • This doesn't provide a solution. Commented Jun 16, 2016 at 19:26

Looking closely at your problem, you are just running apache2. To start apache in Ubuntu, run the following command:

sudo apache2ctl start

Apache configuration are split into multiple files, one of those files are environment variables. When you are running just apache2, these variables are not set.

The apache2ctl script will load the variables (and do some other stuff as well when needed) before starting apache with apache2 -k start.

  • 1
    #sudo apache2ctl start httpd (pid 1390) already running Commented Apr 21, 2014 at 12:43
  • So what is the problem you are having then?
    – Dan
    Commented Apr 21, 2014 at 12:45
  • @AmandeepSingh: try sudo apache2ctl restart instead.
    – scheffield
    Commented Jul 7, 2014 at 10:20
  • 1
    @scheffield Tried this command several times. Problem was due to the root folder location change in new version of Apache from /var/www to /var/www/html. I moved all files to a subfolder /html & it worked. Commented Jul 9, 2014 at 3:44

Edit the configuration: sudo leafpad /etc/apache2/apache2.conf:

# Include the virtual host configurations:

#before upgrade = 
IncludeOptional sites-enabled/*
#after upgrade = 
/IncludeOptional sites-enabled/*.conf

or remove file.

  • +1. The answer was downvoted but it contained the solution to the problem of many administrators who may visit this question.
    – augustin
    Commented Sep 17, 2014 at 10:50

augustin's answer worked for me when all my virtual hosts disappeared following a server upgrade from 12.04 LTS to 14.04 LTS. I would upvote it if I had the reputation to do so.

The following command will add the .conf suffix to all symlinks in /etc/apache2/sites-enabled that don't already have it:

sudo find /etc/apache2/sites-enabled -type l ! -name '*.conf' -exec rename 's/$/.conf/' {} \;

In addition, there has been a change from using the Allow from/Deny from syntax to Require in the mod_authz_host module (here is the link for the 2.2 documentation).

The following command will edit the common usage of Order allow, deny followed by Allow from all to be Require all granted instead:

perl -0777 -pi.bak -e 's/Order\s+allow\s*,\s*deny\s*\n\s*Allow\s+from\s+all/Require all granted/sg' /etc/apache2/sites-available/* 

In fact, the docroot does change between precise and trusty from /var/www to /var/www/html. It is poor that the do-release-upgrade script does not regress the docroot back.

A) Either is valid, but html is more conventional. CentOS is influential in this regard. The "it works" page is more mature now too.

B) You do not have to use /var/www/html, but if you do...

  • you need to migrate your content or alias it (not recommended).
  • you need to update anywhere the old location is referenced.
  • especially backup/restore/customisation scripts.

C) And it may be easier to build from the ground up and migrate.

D) This symptom will occur if you "sudo apache2 -k graceful" out of the box on Trusty, upgrade or not due to envvars not being in scope ?. Use "sudo apache2ctl start/stop/restart" instead.


In my case:

  • The html subfolder at /var/www/ already existed but still I was getting the error: AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf
  • I had already decided to host my websites in my user root e.g. /home/{user}/sites/ instead of the default /var/www/html
  • I am using Apache 2.4.7 (You can check your version with apache2 -v)

How I solved the problem in five easy steps:

  1. In /etc/apache2/apache2.conf I added the following after line 169:

    <Directory /home/{user}/sites/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
  2. I made sure my Virtual Host configuration named website.conf at /etc/apache2/sites-available was copied from the default 000-default.conf, and looked like:

    <VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName website.dev
        ServerAlias www.website.dev
        DocumentRoot /home/{user}/sites/website
  3. I reloaded my site (sudo a2dissite website && sudo a2ensite website) and my server and the initial error was gone. WOOHOO! But a new one emerged: "AH00035: access to / denied (filesystem path '/home/{user}/sites') because search permissions are missing on a component of the path". This I solved in step 4.

  4. The new problem was due to permissions, so I just set each of the directories leading up to the website folder to chmod 755. Every single one! The home folder, the {user} folder, the sites folder, and even my website folder

  5. After refreshing my browser at website.dev everything loaded fine!

P.S. I had already setup website.dev in my /etc/hosts file.

Bonus Tip: To check permissions of a particular folder you can use the command stat -c %a /path/to/file/or/folder. To check permissions of every part of a directory use namei -m /path/to/final/folder.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .