1
$ apache2 -v
Server version: Apache/2.4.7 (Ubuntu)
Server built:   Jan 14 2016 17:45:23

My Ubuntu version is 14.04.

I was fixing a few things on /etc/apache2/sites-available/000-default.conf and then the next time I restarted Apache, I keep getting this weird error:

$ sudo service apache2 reload
 * Reloading web server apache2      [fail]                                                                          * 
 * The apache2 configtest failed. Not doing anything.
Output of config test was:
env: apache2ctl: No such file or directory

I also reverted all the changes in 000-default.conf, but the issue is not getting resolved.

I do not understand how I might have caused this issue and also I don't know how to resolve it.

Help would be highly appreciated.


Latest Apache error logs:

[Sun Jun 05 11:50:26.341221 2016] [mpm_worker:notice] [pid 6035:tid 118764177487744] AH00292: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Sun Jun 05 11:50:26.341266 2016] [core:notice] [pid 6035:tid 118764177487744] AH00094: Command line: '/usr/sbin/apache2'
[Sun Jun 05 12:15:51.071093 2016] [mpm_worker:notice] [pid 6035:tid 118764177487744] AH00295: caught SIGTERM, shutting down
6
  • What is in the Apache error log?
    – Colt
    Jun 5, 2016 at 16:59
  • @Colt I updated the question with the latest logs. The same logs are repeated over and over a couple times in the log file.
    – aborted
    Jun 5, 2016 at 17:11
  • and apache2ctl -t ?
    – Colt
    Jun 5, 2016 at 17:16
  • 1
    Wow! It says The program 'apache2ctl' is currently not installed. You can install it by typing: apt-get install apache2, but it was working earlier as expected? I'm really confused now.
    – aborted
    Jun 5, 2016 at 17:33
  • 1
    @Colt the command above returns this: -rwxr-xr-x 1 root root 637528 Jan 14 18:46 /usr/sbin/apache2
    – aborted
    Jun 6, 2016 at 8:27

3 Answers 3

5

You are missing the apache2ctl script and the symlink for apachectl. For Ubuntu 14.04, both should be in the /usr/sbin/ directory with the following dates (normal installation, upgrades) and permissions:

-rwxr-xr-x 1 root root   6402 Jan  3  2014 /usr/sbin/apache2ctl
lrwxrwxrwx 1 root root     10 Jan 14 17:46 /usr/sbin/apachectl -> apache2ctl

If you have a backup of your system, you should recover. If not, you will need to repair the Apache2 installation.

NOTE ALSO: The /usr/sbin/ directory is a shared directory holding all scripts generally accessible with root privileges. Given that you do not know how the apache2 files went missing, you could have problems beyond this issue or even beyond apache2.

2
  • What would be the best way to repair the Apache2 installation?
    – aborted
    Jun 6, 2016 at 11:55
  • 2
    Given that you do not know what happened to the missing files, or what other files may be messed up, you probably need to consider removing or purging the apache2 package and installing it again. Depending on how you proceed, your configuration and site files may be lost on the server, so make sure you have a backup of all of your files and configured apache2 files.
    – Colt
    Jun 6, 2016 at 12:08
0

env: apache2ctl: No such file or directory

I don't have an Ubuntu system to hand but it looks like the PATH may be malformed and env cannot find apache2ctl.

0

What solved the problem for me was running the command (Ubuntu):

sudo apt install apache2

which installed the missing apache2ctl while keeping everything else untouched.

You must log in to answer this question.

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