2

I did the latest update on Mac High Sierra two days ago and after that I am unable to start apache on port 80. I keep getting

(48)Address already in use: AH00072: make_sock: could not bind to address [::]:8080 (48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:8080 no listening sockets available, shutting down AH00015: Unable to open logs

I checked what is running on ports 80 using sudo lsof -i TCP:80:

COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
httpd   15116 root    4u  IPv6 0xe9c01ec682a44c67      0t0  TCP *:http 
(LISTEN)
httpd   15387 _www    4u  IPv6 0xe9c01ec682a44c67      0t0  TCP *:http 
(LISTEN)
httpd   15388 _www    4u  IPv6 0xe9c01ec682a44c67      0t0  TCP *:http 
(LISTEN)

and sudo lsof -i TCP:8080:

httpd   11689 daemon    4u  IPv6 0xe9c01ec68ff9f6a7      0t0  TCP 
*:http-alt (LISTEN)
httpd   11690 daemon    4u  IPv6 0xe9c01ec68ff9f6a7      0t0  TCP 
*:http-alt (LISTEN)
httpd   11691 daemon    4u  IPv6 0xe9c01ec68ff9f6a7      0t0  TCP 
*:http-alt (LISTEN)
httpd   11744 daemon    4u  IPv6 0xe9c01ec68ff9f6a7      0t0  TCP 
*:http-alt (LISTEN)

When I hit localhost:8080 I get

EnterpriseDB
Apache - version 2.4.12 
PHP - version 5.5.26 
Server is up and running 
The default Apache context is www in the Apache installation folder

and then tried to kill the relevant processes on port 8080 using sudo kill -9 portId but no luck.

Last but not least I want to mention that before the updade on /etc/apache2/httpd.conf I had:

<IfDefine SERVER_APP_HAS_DEFAULT_PORTS>
   Listen 8080
</IfDefine>
<IfDefine !SERVER_APP_HAS_DEFAULT_PORTS>
  Listen 80
</IfDefine>

and everything was fine until the update..

Any help is appreciated.


I attach what I get on 31/07/2018 as indicated by @ Ivan Hušnjak

Running sudo lsof -i TCP:80 I get absolute nothing back

Running sudo lsof -i TCP:8080 returns:

COMMAND  PID   USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
httpd   7470   root    4u  IPv6 0xe7c340f978e197b1      0t0  TCP *:http-alt (LISTEN)
httpd   7481 daemon    4u  IPv6 0xe7c340f978e197b1      0t0  TCP *:http-alt (LISTEN)
httpd   7483 daemon    4u  IPv6 0xe7c340f978e197b1      0t0  TCP *:http-alt (LISTEN)
httpd   7484 daemon    4u  IPv6 0xe7c340f978e197b1      0t0  TCP *:http-alt (LISTEN)
kboul
  • 13,836
  • 5
  • 42
  • 53

1 Answers1

1

My guess is that MaxOS internal apache server had overtake control of port 80 after the update to 10.13.5, however I solve this issue by unloading it like explained in these older answers found here https://stackoverflow.com/a/46720652/555097 and here https://stackoverflow.com/a/11720851/555097

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
Ivan Hušnjak
  • 3,493
  • 3
  • 20
  • 30
  • I will give it a try when I go home and let you know – kboul Jul 27 '18 at 14:49
  • Unfortunately, it did not work. I keep taking the error I mentioned in the beginning of the post. Is there any other thing I can do to investigate more the issue? Do you want to post my httpd.conf or any other file to take a look? – kboul Jul 28 '18 at 08:13
  • This worked for me as I was not trying to use system apache, but one from MAMP installation. Have you tried looking at registered deamons/services via `sudo launchctl list` and compare if any of PID's of the lsof results matches? – Ivan Hušnjak Jul 30 '18 at 08:53
  • btw I dont think anything is wrong with your `httpd.conf` as it would throw different kind of error when trying to run `apachectl`, however you can test if configuration is ok by `sudo apachectl configtest` and see if it complains about antyhing – Ivan Hušnjak Jul 30 '18 at 08:56
  • I am not using MAMP. I do not know about registered deamons/services but I will take a more thorough look. I will investigate also any possible errors using sudo apachectl configtest. Thank you very much for your suggestions. Back-end is not my expertise so I will definitively need any advises. – kboul Jul 30 '18 at 09:00
  • `sudo apachectl configtest` returns `Syntax OK` – kboul Jul 30 '18 at 18:08
  • Running `sudo launchctl list` returns [this](https://gist.github.com/kboul/ec2253ab0747a748a70826f75fb1c114) – kboul Jul 30 '18 at 18:13
  • 1
    now compare PID's of the results of `launchctl list` and `lsof` for ports 80 an 8080, and see if anything matches... if it does try to google that process and see what is it about, and if its safe to unload it with the `launchctl unload` command – Ivan Hušnjak Jul 31 '18 at 08:54
  • the lists need to be both valid for comparison, so I cannot help you with the one you have posted in that link as lsof results in this question are 14 days old and PIDs will definitely be different, and with so much processes I cannot tell you which of them may or may not use port 80 or 8080 – Ivan Hušnjak Jul 31 '18 at 08:57
  • I did what you indicated. There is a match for only **one process**. The one which has `PID 7470` and has to do with `com.edb.launchd.apache`. I googled it and is related to apache's autostart or sth relevant. – kboul Jul 31 '18 at 17:00