Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

starting apachectl from bash

Tags:

linux

bash

apache

I am writing a bash file. I need to start apachectl from my bash file. so i wrote:

apachectl start

When I run it with root, an error occurred:

apachectl: command not found

I searched and I found that, I should be super user with su - not su

Now, I want to know:

  • why this error occurred?

  • How could i run it with su?

like image 230
Behnam Safari Avatar asked Feb 19 '12 09:02

Behnam Safari


2 Answers

The answer above helped me a lot but the commands should be:

sudo netstat -tanp
sudo ss -tanp 'sport = 80'
sudo apt-get remove lighttpd
sudo <path>/apachectl -kstart
like image 174
user7856422 Avatar answered Sep 25 '22 00:09

user7856422


Use the find command to first locate apachecetl

find / -name apachectl

Then you can test it by running the status command (assuming this is the location from the find command)

/usr/local/sbin/apachectl status

Then you may need to restart apache if there's an issue

/usr/local/apache/bin/apachectl restart
like image 30
Jayden Lawson Avatar answered Sep 26 '22 00:09

Jayden Lawson