I ran into a problem with Apache I installed with homebrew claiming it had started, but not actually running.

Pauls-MBP-1675:~ paulreinheimer$ brew services stop httpd
Stopping `httpd`... (might take a while)
==> Successfully stopped `httpd` (label: homebrew.mxcl.httpd)
Pauls-MBP-1675:~ paulreinheimer$ brew services start httpd
==> Successfully started `httpd` (label: homebrew.mxcl.httpd)

That ran well, but I couldn't actually visit my site, and there was nothing showing up in the apache error log. Turning up logging to info also revealed nothing.

Trying to start apache directly (without brew) gave me a slightly different message:

Pauls-MBP-1675:~ paulreinheimer$ /usr/local/opt/httpd/bin/httpd
httpd (pid 391) already running

Well, there's a clue. Apache isn't already running, and pid 391 is something else completely.

Stopping apache with apachectl was enough to clear wherever it was storing the pid, and allow apache to start normally.

Pauls-MBP-1675:~ paulreinheimer$ cd /usr/local/opt/httpd/bin/
Pauls-MBP-1675:bin paulreinheimer$ ls
ab		apxs		dbmmanage	htcacheclean	htdigest	httpd		logresolve	suexec
apachectl	checkgid	fcgistarter	htdbm		htpasswd	httxt2dbm	rotatelogs
Pauls-MBP-1675:bin paulreinheimer$ apachectl stop
Pauls-MBP-1675:bin paulreinheimer$ brew services start httpd
==> Successfully started `httpd` (label: homebrew.mxcl.httpd)

Photo by Andrea Piacquadio from Pexels