What does "apache2ctl:: command not found" mean if Apache IS installed and running?

27,269

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:
27,269

Related videos on Youtube

blunders
Author by

blunders

Updated on September 17, 2022

Comments

  • blunders
    blunders over 1 year

    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  ]
    
  • blunders
    blunders over 13 years
    @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.
  • EEAA
    EEAA over 13 years
    If all you're trying to do is restart apache, why don't you just use the init script? /etc/init.d/httpd restart?
  • blunders
    blunders over 13 years
    @ErikA: See above... :-)
  • Andrew
    Andrew over 10 years
    I think in 'Enterprise Linux' and Fedora, apachectl is equivalent to apahe2ctl in Debian distributions.