Cannot start Apache, config test fail: "env: apache2ctl: No such file or directory"
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
.
Related videos on Youtube
aborted
Updated on September 18, 2022Comments
-
aborted over 1 year
$ 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
-
Colt almost 8 yearsWhat is in the Apache error log?
-
aborted almost 8 years@Colt I updated the question with the latest logs. The same logs are repeated over and over a couple times in the log file.
-
Colt almost 8 yearsand
apache2ctl -t
? -
aborted almost 8 yearsWow! 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. -
Colt almost 8 yearswhat does
sudo ls -la /usr/sbin/apache*
return? -
aborted almost 8 years@Colt the command above returns this:
-rwxr-xr-x 1 root root 637528 Jan 14 18:46 /usr/sbin/apache2
-
-
aborted almost 8 yearsWhat would be the best way to repair the Apache2 installation?
-
Colt almost 8 yearsGiven 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 configuredapache2
files.