Skip to main content
17 events
when toggle format what by license comment
Sep 13 at 14:49 comment added Gwyneth Llewelyn brew install lsof (if not installed) and then do a sudo lsof -i :8080 (or :80, depending on what port you're running Apache). You should get a list of the services that are using/listening to that specific port. If Apache was correctly launched from launchd — as it should! — the first entry ("command") ought to be set to launchd. If that's not the case, then Apache was launched from elsewhere.
Jul 9, 2019 at 11:57 comment added jksoegaard @Shuzheng Then you must have done something that you have not detailed. If you have the default setup, then "launchctl list" should initially not display Apache. After using "apachectl start", it should show up with a PID. When using "apachectl stop", it should stop being there at all. To get to the state you have described, you could have done something like "apachectl start" - and then killed the process manually, or by having an invalid configuration or similar. Then you have it not running while the service is loaded.
Jul 9, 2019 at 11:38 comment added Shuzheng @jksoegaard - I didn't install Apache. I use the default Apache that comes with macOS Mojave. Apple has created the apachectl script.
Jul 9, 2019 at 11:34 comment added jksoegaard @Shuzheng Ah, it wasn't entirely obvious to me that this was the same question and not a new one. In this case, no - it's not setup as an ondemand service. However, note that your currently running Apache process could be started by something else than launchd. Then it would show up as not running in launchd (as it wasn't started by launchd), while you could still retrieve pages from it due to it being run by something else... In order to be able to guide you - tell us how you installed Apache (homebrew, or?), and how you started it.
Jul 9, 2019 at 11:18 comment added Shuzheng @jksoegaard - I've already included the output for that command in the original question. What should <daemon> be substituted with in your answer? org.apache.httpd? The way apachectl launch Apache is by /bin/launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist - is this an "ondemand" service, so that it is not registered in launchd? In fact the output of launchctl list includes "OnDemand" = false;.
Jul 9, 2019 at 10:51 history edited jksoegaard CC BY-SA 4.0
added 497 characters in body
Jul 9, 2019 at 10:47 comment added jksoegaard @Shuzheng Also be aware that launchd supports "ondemand" services, which is most probably how you have setup Apache. This means that Apache is not running all the time (i.e. when you run launchctl) - but only when you actually use it (i.e. when you ask your web-browser to request pages from it)
Jul 9, 2019 at 10:44 comment added jksoegaard @Shuzheng what's the output of "launchctl list org.apache.httpd" on your system?
Jul 9, 2019 at 10:42 history edited jksoegaard CC BY-SA 4.0
added 1 character in body
S Jul 9, 2019 at 10:41 history rollback jksoegaard
Rollback to Revision 2 - Edit approval overridden by post owner or moderator
Jul 9, 2019 at 9:15 comment added Shuzheng @GordonDavisson - apachectl start is equivalent to /bin/launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist by inspecting /usr/bin/apachectl. Isn't that launching through launchd? If not, how would I launch it through launchd? Thanks.
Jul 9, 2019 at 8:17 comment added Gordon Davisson @Shuzheng Apache is probably being launched by something other than launchd (or possibly by a different launch daemon item).
Jul 9, 2019 at 6:53 history suggested Shuzheng CC BY-SA 4.0
they are applications, not systems.
Jul 9, 2019 at 5:48 review Suggested edits
S Jul 9, 2019 at 10:41
Jul 9, 2019 at 5:45 comment added Shuzheng Thanks, jksoegaard. What makes me confused it that I know Apache is running. I started it using apachectl and can access it on 127.0.0.1. This is why I don't understand that lauchctl's output misses the "Active:" (running) information of systemctl. Do you have any idea why lauchctl's doesn't report a valid PID for Apache (httpd)?
Jul 8, 2019 at 17:49 history edited jksoegaard CC BY-SA 4.0
added 1081 characters in body
Jul 8, 2019 at 17:28 history answered jksoegaard CC BY-SA 4.0