1

Last week my local Apache stopped working with no messages in error.log...

Checking system.log I see this:

com.apple.xpd.launchd: (org.apache.httpd) Service only ran for 0 seconds. Pushing respawn out every 10 seconds.

After some googling I ran sudo /usr/sbin/httpd -k start -e Debug -E /dev/stdout

This gives me a list of loaded modules followed by a message about httpd already running:

...
[Wed Sep 30 22:01:04.344972 2015] [so:debug] [pid 8657] mod_so.c(266): AH01575: loaded module alias_module from /usr/libexec/apache2/mod_alias.so
[Wed Sep 30 22:01:04.345183 2015] [so:debug] [pid 8657] mod_so.c(266): AH01575: loaded module hfs_apple_module from /usr/libexec/apache2/mod_hfs_apple.so
httpd (pid 80) already running

I get the same result even if I first run sudo apachectl stop

Running ps aux | grep [h]ttpd shows that httpd is not running.

Help appreciated!

bleen
  • 166
  • 1
  • 7
  • 1
    Are you sure that it means PID 80? And not _port 80_? Seems to me like the more likely scenario. Do you have Skype running? It liks to bind to port 80 / 443, and will prevent webservers from starting. If you have skype open, kill it and relaunch httpd. If no skype, check to see if httpd is already running, or if something else running has already bound to port 80. – Matt Clark Oct 01 '15 at 02:23
  • I agree that PID 80 looks suspicious, but that is what it says. I have skype installed, but not running. httpd does not appear to be running. – bleen Oct 01 '15 at 02:26
  • What platform are you running on? Specifically? Ubuntu? Centos? Are you running an OS that is managed by _selinux_? This seems like it could also be a permissions issue. Also know that any program that binds to ports *below 1000* require them be run as _root_. – Matt Clark Oct 01 '15 at 03:42
  • I have completely uninstalled Skype but the problem persists ... is there a way to tell what application may be bound to port 80 and getting in the way? – bleen Oct 01 '15 at 13:53
  • .... also I'm using OSX El Capitan, though this issue started while I was still using Yosemete – bleen Oct 01 '15 at 13:53

2 Answers2

4

I know this question is 5 years old, but this is how I resolved my instance.

  1. First I located my log files. In the apache config folder I did -

    grep "ErrorLog" httpd.conf

  2. I noticed The following error: pid file /usr/local/var/run/httpd/httpd.pid overwritten -- Unclean shutdown of previous Apache run?

So I removed httpd.pid and restarted apache. This resolved the issue for me.

It may not be the same issue, but the error logs are extremely useful for diagnosing the proble,

Nick Bloor
  • 113
  • 8
  • My Mac running Big Sur crashed (very unusual!) and after rebooting the mac Apache wouldn't start. sudo apachectl stop didn't complain, but I still couldn't start (error "httpd already running"). Deleting the http.pid file did the trick! – Christer Fernstrom Sep 30 '21 at 19:25
  • The last time the error.log was written to was over a month ago so I hadn't thought of checking in there. But there was the error about the pid! Thanks so much for this ! – mwarren May 08 '22 at 10:26
1

Problem you are having is may be due Skype(if installed) or similar applications that is running on your system which uses default port 80).
If you have Skype running on your system, then following steps may solve your problem

  1. Go to Skype -> Tools -> Options -> Advance Settings -> Connections

  2. uncheck " use port 80 and 443 for additional incoming connections "

enter image description here

  1. Save settings and re-start your Apache and Skype

I hope this will solve your problem, please let us know if it didn't work

Note: I have answer in regards to Windows machine, but I believe if skype is the problem it should work on other platform as well.

Cheers,
🍻

  • 1
    Thanks Saurab, this is exactly what I left as a comment on the question, which is what it is, a comment. This is not a solution, this is a debugging step. – Matt Clark Oct 01 '15 at 03:40
  • Ya I kinda try explaining a bit more, may be he is missing the steps I thought. You are right its a debugging step – Saurab Dulal Oct 01 '15 at 04:01
  • I do not have Skype installed at all, but the problem persists – bleen Oct 01 '15 at 13:58
  • Hi bleen, may you try the solutions on the following references, [link](http://stackoverflow.com/questions/4582504/xampp-apache-webserver-localhost-not-working-on-mac-os/11720851#11720851), [link](https://discussions.apple.com/thread/963853?tstart=0) – Saurab Dulal Oct 04 '15 at 03:22
  • Saurab: The first link stops this message from appearing in console: ```com.apple.xpd.launchd: (org.apache.httpd) Service only ran for 0 seconds. Pushing respawn out every 10 seconds.```, but Apache is not starting. The second link reveals that something called IMRemoteU running on 80 ```IMRemoteU 601 bleen 7u IPv4 0xaad895552a49b4e5 0t0 TCP 10.0.1.6:51296->107.14.41.136:http (CLOSE_WAIT)``` I dont know what that is, how to kill it and google tells me nothing. Ideas? – bleen Oct 06 '15 at 15:25