Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I noticed that on my linux server when i type apachectl restart it gives me little but helpful feedback such as restarting and then [ok] or [fail] at the end of the line. Not much, but at least I know what is going on, and I can go check logs.

On my OS X i get nothing. just the next line immediately:

sh-3.2# /usr/sbin/apachectl stop   
sh-3.2# /usr/sbin/apachectl start

How can I enable those 'debug' features?

share|improve this question
I'm not familiar with OS X, but you can edit the init script to add an echo line. – quanta Aug 5 '11 at 9:19
where is that script? and what line should i add echo to? Sorry, i am new around and need details :\ – mgPePe Aug 5 '11 at 9:28
I'm not an OS X guy, but perhaps it just follows the Unix philosophy of "no news is good news", and starts to nag you only if there's something wrong? – Janne Pikkarainen Aug 5 '11 at 9:34
hmm silent errors don't help, so i am not a fan really – mgPePe Aug 5 '11 at 10:16
Please post the content of /usr/sbin/apachectl. – quanta Aug 5 '11 at 10:26
up vote 5 down vote accepted

How about in the apachectl wrapper script you stick something like this at the end.

tail -5 /var/log/httpd/error_log

you should see something like this in a normal startup

  • [Fri Apr 22 23:39:20 2011] [notice] Digest: generating secret for
    digest authentication ...
  • [Fri Apr 22 23:39:20 2011] [notice] Digest: done
  • [Fri Apr 22 23:39:20 2011] [warn] pid file
    /mlk/apache/pid/ overwritten -- Unclean shutdown of previous Apache run?
  • [Fri Apr 22 23:39:20 2011] [notice] Apache/2.0.63 (Unix) DAV/2 configured -- resuming normal operations

Otherwise any error should at least in part be shown here. The key phrase is hilighted above.

Additional: /usr/sbin/apachectl is owned by root, you must be a privileged user to do this. sudo vi /usr/sbin/apachectl

move to the end of the file and insert this between the "esac" and "exit $ERROR" lines. ie.

sleep 2; tail -5 /var/log/httpd/error_log
exit $ERROR

Note this will print out the last few lines no matter what action you take with the script, stop start, restart. you may want to only put it in the start part of the case statement.

share|improve this answer
That sounds like a possible solution. And how could I attach it so that it automatically executes with each restart command? – mgPePe Aug 5 '11 at 12:54
Had to ssh into my macos server at home to look at /usr/bin/apachectl Look in the answer above i've added the commands to edit the file. – Michael Henry Aug 5 '11 at 14:45

I have the same problem on my mac. When ever I attempt to start apache and nothing happens, I immediately run this command. In my case the problem always seems to be in the apache configuration files.

apachectl configtest
share|improve this answer
Thanks for this. I was running into this issue myself, and turns out that an update to homebrew SQLite was causing homebrew PHP to kick up an Apache error that didn't show up anywhere except in configtest. – AlexMax Jan 16 '13 at 15:18
Thank you thank you thank you!!! This has just saved my sanity!!! – And Finally Oct 21 '14 at 15:40

apachectl on the Mac is a wrapper around some launchctl commands (just look into the file). Unfortunately, launchctl doesn't exit with an error code when something goes wrong with starting httpd, so the script has no easy way to display anything, even if it tries to.

A basic check you can perform yourself is to check the existence of Apache processes after the apachectl start command.

ps aux | grep httpd
share|improve this answer
in a way, you are saying, "there is no such debug info you can set on macosx, but this is how you can check if the apache server is running" is that right? – mgPePe Aug 5 '11 at 10:50
Yes, that's about it. – Sven Aug 5 '11 at 10:52

Your Answer


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.