Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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  ]
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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
share|improve this answer
    
@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
    
I think in 'Enterprise Linux' and Fedora, apachectl is equivalent to apahe2ctl in Debian distributions. –  Andrew Dec 10 '13 at 3:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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