Trying to run the command "apache2ctl restart" and just got this message "apache2ctl:: command not found" -- thing is, Apache IS installed, running, and I'm actively doing development on the server right now... any ideas?

CONTEXT: sudo access on CentOS-5.5 on VM

UPDATE: Good news, restarted Apache, bad news 500 error, still it's progress... :-)

[username@VMname /]$ sudo /etc/init.d/httpd restart
[username@VMname /]$ sudo /etc/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

Looks like apache2ctl isn't in your path. Try this instead:

$ sudo /usr/sbin/apache2ctl restart

The above location reflects the location of apache2ctl in Ubuntu. I'm not sure where the default location is on CentOS. If the above command doesn't work, you can find the location by running the following as root:

$ which apache2ctl
  • @ErikA: Thanks! So, I did a find as sudo of the whole computer for a apache2ctl, and nothing. There is a apachectl, but that's not for Apache2 I don't believe (info.php is reporting the system as Apache2); "which apache2ctl", didn't work either, but appears to have confirmed it check in the bin directories; sbin was not listed, but that's where I found apachectl. Really have no idea. Are there any httpd conf that would point to it, guessing not but have no idea at this point. "sudo /usr/sbin/apachectl restart echo $?" did appear to execute and return what appears to be a httpd help page. – blunders Oct 15 '10 at 3:10
  • If all you're trying to do is restart apache, why don't you just use the init script? /etc/init.d/httpd restart? – EEAA Oct 15 '10 at 3:12
  • @ErikA: See above... :-) – blunders Oct 15 '10 at 3:19
  • 1
    I think in 'Enterprise Linux' and Fedora, apachectl is equivalent to apahe2ctl in Debian distributions. – Andrew Dec 10 '13 at 3:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.