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
?
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With