Error while starting apache2 server in ubuntu

10.6k Views Asked by At

systemctl start apache2.service

Getting this error:-

Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.

Logs of systemctl status apache2.service

● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; disabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Tue 2020-06-02 08:24:55 IST; 49s ago
  Process: 9759 ExecStart=/usr/sbin/apachectl start (code=exited, status=127)

Jun 02 08:24:55 GS-4996 systemd[1]: Starting The Apache HTTP Server...
Jun 02 08:24:55 GS-4996 apachectl[9759]: /usr/sbin/apachectl: 174: /usr/sbin/apachectl: /usr/sbin/apache2: not found
Jun 02 08:24:55 GS-4996 apachectl[9759]: Action 'start' failed.
Jun 02 08:24:55 GS-4996 apachectl[9759]: The Apache error log may have more information.
Jun 02 08:24:55 GS-4996 systemd[1]: apache2.service: Control process exited, code=exited status=127
Jun 02 08:24:55 GS-4996 systemd[1]: apache2.service: Failed with result 'exit-code'.
Jun 02 08:24:55 GS-4996 systemd[1]: Failed to start The Apache HTTP Server.
5

There are 5 best solutions below

0
Pandurang On BEST ANSWER

Looks like the apache2 file is not available on server. /usr/sbin/apache2 is provided by apache2-bin. apache2-bin is a dependency of the apache2 package, so apache2 will not work properly without it. Open the terminal and type:

sudo apt install --reinstall apache2-bin   
sudo service apache2 start  
0
Hassan Dallal On

Can you please attach error logs or the output of "systemctl status apache2.service"

0
Mostafa Mahmoud On

My Best Solution No Need Restart .. After Long Time of se :)

sudo apt-get --reinstall install apache2-bin
0
BuyFullCode On

Step 1: Stop nginx & Start apache

That's it.

service nginx stop
systemctl restart postgresql
systemctl restart apache2
systemctl status apache2.service
0
babaloo On

I am trying for one day or something to install wordpress on my lubuntu. I tried several versions of installation, it is almost so hard as installing flutter :) This works, this works not... And now, I am trying to install wordpress with XAMPP. And in /opt/lampp folder, where my XAMPP installation is, among other, i see apache2 folder.

  1. So, maybe, you should just uninstall XAMPP first, then install apache2

  2. After installing apache2 try to restart your machine, then sudo systemctl enable apache2 sudo systemctl status apache2 to see if it works

  3. when trying to install php to lubuntu, system, among other, offers installation of apache2- so try this one: sudo apt install php