4

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  ]

2 Answers 2

6

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
4
  • @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, 2010 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, 2010 at 3:12
  • @ErikA: See above... :-)
    – blunders
    Oct 15, 2010 at 3:19
  • 1
    I think in 'Enterprise Linux' and Fedora, apachectl is equivalent to apahe2ctl in Debian distributions.
    – Andrew
    Dec 10, 2013 at 3:29
0

Did any response was helpful?

I think you should be using httpd commands due to you are using Centos (RedHat)

I started looking for httpd commands too, they are not the same as the majority of examples we can find on the internet (referring to apache2 - Debian based distributions)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .