httpd from the command line, how do I quit it?

isolder

Registered
Ok, for one thing.. I have to log in as root in order to start httpd?
sudo -s and I can log in and start httpd.. but is this necessary? I thought I could start it since I'm an admin without logging in as root?


Really though, my main question was how to stop httpd from the command line. I can stop it from turning off web sharing in the Preferences panel.. but want to work from the command line and can't seem to figure it out though it must be so very simple.


fopen: permission denied and
httpd:could not open error log file...... (....going to error_log)
 
No, because although you are an admin, you don't have the admin rights unless you use sudo. You don't have to do sudo -s to log in, though, if all you are doing is one command.

Easiest way to start, restart, or stop apache would be apachectl. The respective commands are apachectl start apachectl restart and apachectl stop. That's all there is to it, really.
 
Darkshadow is correct, but I would add more emphasis. "apachectl" is not just the easiest way, but the only correct and safe way to stop apache. There's also apachectl graceful which restarts Apache without breaking any current connections and allows you to "detach" its log files - which you might do in a log-rolling cron job for example.
 
Back
Top