jedaffra
October 30th, 2002, 17:03
Hi again,
I'm running apache on OS X and I am making mods to httpd.conf via puTTY from a win2k box.
I wish to restart apache but don't know the command(s). I could always go to the os x box and clik the little on/off button under system preferences... but I want an even easier (for me) solution.
I'm sure someone hear knows how to restart apache from the terminal. Thanks for the input gang :wink:
KrUsTy!
October 30th, 2002, 17:43
apachectl is the command.
to start apache
apachectl start
to stop
apachectl stop
to restart;
apachectl restart
That sometimes is different bewteen *nixes, but I've found that it is generally true.
Should be able to "man apachectl" and see the manual page for it, and if those commands hold true on Mac OS X.
Hope this helps...
{K}
bsdjunkie
October 30th, 2002, 18:24
If OS X doesnt have the apachectl cmd (im not sure off hand though it likely does) you can just ps -aux and find the httpd pid and kill -HUP it.
frisco
October 30th, 2002, 19:17
apachectl restart
keep in mind that 'apachectl restart' isnt the same as 'apachectl stop; apachectl start'. not an issue for simple httpd.conf changes but may burn you for trickier modifications.
schotty
October 30th, 2002, 20:24
frisco :: what is the difference? I am not an Apache admin, but in case I ever end up having to do so, what is the difference? I was under the presumpion that a restart genereally was a stop then start.
Thanks much!
frisco
October 30th, 2002, 21:10
restart does a kill -HUP to the process. stop kills off the process. start starts the process.
-HUP isn't necessarily the same, particularly now that apache (in OpenBSD) is chroot'ed.
c.f. http://marc.theaimsgroup.com/?l=openbsd-misc&m=103598750427881&w=2
i've encountered the situation before on Solaris where restart didnt work but stop/start did, but can't remember what the exact problem was - i think it was something to do with rebuilding a new version of php. Usually when restart doesn't give the deisred effects, stop/start does.
|MiNi0n|
October 31st, 2002, 10:17
i've encountered the situation before on Solaris where restart didnt work but stop/start did, but can't remember what the exact problem was - i think it was something to do with rebuilding a new version of php. Usually when restart doesn't give the deisred effects, stop/start does.
Yup... I've seen the same thing... it was php too I believe... after I made some changes to php.ini. So... now I almost never use restart, just stop and start to be safe.
jedaffra
November 1st, 2002, 15:57
Hey Thanks everybody for the info.
As I'm running apache on a Mac it would have to be different (that's their slogan isnt it... "think different") than the norm.
Seems like apache is configured different on the OS X than for other nixes. The apachectl command didn't work as expected. I logged in via puTTY and apachectl'd the machine to stop but was told it wasnt running to begin with. I thought, hmmm, that's strange seeing as how I'd been surfing to my web address all morning. So I tried apachectl help and was told I have to type the full path like so "/usr/sbin/apachectl (command a, command b, etc etc)". Great (I thought), I'll try typing "/usr/sbin/apachectl restart" and see what happens. I'm told (a) httpd not running, (b) trying to start, (c) processing config directory: /private/etc/httpd/users, (d) processing config file: /private/etc/httpd/users/myusername.conf, (e) [alert] httpd: could not determine server's fully qualified domain name, using 127.0.0.1 for ServerName, (f) fopen: Permission Denied, (g) httpd: could not open error log file /private/var/log/httpd/error_log, and finally (sigh) (h) /usr/sbin/apachectl restart: httpd could not be started.
That was a mouthfull. Anyway, I checked around on Google and saw only one similar posting that nobody replied to or had an answer for :roll:.
Oil well.
Thanks again to all for the info. Maybe apache.org knows something I don't.
Have a great weekend everyone!!
:)
elmore
November 1st, 2002, 16:21
Anyone have an OS X box lying around that they can fiddle with?
I have one but don't know if I'll have the time to play around with it this weekend.
bsdjunkie
November 1st, 2002, 17:54
If i have some time, ill plug in mine again this weekend and check it out.
frisco
November 1st, 2002, 21:03
on every other unix, apachectl is a shell script. i'd be surprised if it isn't on MacOS X as well.
so, try reading through that script, it may help you understand those error messages.
also, if i had a MacOS X box, i'd be looking for startup files... like what is run at boottime, and figure out how apache is started at boot. if there weren't /etc/rc* files then i would look for/etc/rc.*d/* files, or i would do something like 'grep apache /etc/*' to find what file starts apache. once you know how apache is started at boottime, chances are stopping/starting it at runtime will be similar.
good luck.
bsdjunkie
November 1st, 2002, 21:32
I do know offhand that the apache config files are kept in /etc/httpd/
The root of the webserver is in /Library/WebServer
if there weren't /etc/rc* files then i would look for/etc/rc.*d/* files,
rc files is correct, there is no /etc/rc*.d/ directories.
8)
jedaffra
November 3rd, 2002, 16:19
I do know offhand that the apache config files are kept in /etc/httpd/
The root of the webserver is in /Library/WebServer
Yes, this is the exact same setup on my OS X box. I've been editing httpd.conf in /etc/httpd and store my html files within /Library/WebServer/Documents
And thanks frisco for the info. Unfortunately I usually dont get to "play" with these sorts of things until at least Wednesday of each week (due to weekly work deadlines) so it will take me until then to start looking into the startup routine/scripts. I'll report back then with my "findings".
Cheers all!
z0mbix
November 5th, 2002, 06:44
My work Mac runs apache and I use sudo /usr/sbin/apache restart to restart it. Mac's don't have the root account enabled by default, so you have to enter your password to confirm that you wish to restart it :)
HTH
hugh nicks
November 5th, 2002, 11:49
sorry to be off topic here, but Krusty will vouch for my sweaty palms! i can't believe that cheeky_zombie's signature is that!
you totally rock! :D
best... game... ever.
-hn-
jedaffra
November 5th, 2002, 11:57
I use sudo /usr/sbin/apache restart to restart it. Mac's don't have the root account enabled by default, so you have to enter your password to confirm that you wish to restart it
The pearls of wisdom floating around here - I'm forever amazed. Thanks "CZ". Although sudo /usr/sbin/apache restart threw an error, sudo /usr/sbin/apachectl restart did the trick (see the diff?).
I should've known to type sudo before attempting that. I've had to type sudo vi filename to edit any *.conf files and have the changes saved, it should'nt have been any different for any other command (D'oh - with a capital D).
Cheers :wink:
z0mbix
November 6th, 2002, 07:12
[quote:91ace10ce3="cheeky_zombie"] I use sudo /usr/sbin/apache restart to restart it. Mac's don't have the root account enabled by default, so you have to enter your password to confirm that you wish to restart it
The pearls of wisdom floating around here - I'm forever amazed. Thanks "CZ". Although sudo /usr/sbin/apache restart threw an error, sudo /usr/sbin/apachectl restart did the trick (see the diff?).
I should've known to type sudo before attempting that. I've had to type sudo vi filename to edit any *.conf files and have the changes saved, it should'nt have been any different for any other command (D'oh - with a capital D).
Cheers :wink:[/quote:91ace10ce3]
sorry, that's what I meant :oops:
<mentalnote>type slower and read what you've typed</mentalnote>
jedaffra
November 6th, 2002, 08:28
sorry, that's what I meant
<mentalnote>type slower and read what you've typed</mentalnote>
Hey, no sweat at all. Thanks again for the point in the right direction, I really appreciate it.
Cheers, :)