6

So, this seems to be a relatively common problem, but following the steps other users used to resolve the issue don't seem to be working for me.

I recently upgraded OSX to Monterey on my early 2015 MBP. Currently running the brew services stop, start, and restart httpd return success messages, but navigating to localhost or my virtual hosts results in refused connections.

Running which httpd points to the Homebrew path at /usr/local/bin/httpd

Currently running brew services returns

Name    Status     User   File
httpd   error  256 root   ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist
mysql   started    Nizz0k ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
[email protected] none      

Brew doctor complains about a deprecated package proj@7, but it's installed as a dependency to some spatial packages I'm working with. It also complains about my Ansible and Postgres config files, but they haven't caused any problems before this update.

apachectl configtest complains about the server but returns syntax ok

I've tried reinstalling, but after completing the process starting httpd errors with

Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/502 /Users/Nizz0k/Library/LaunchAgents/homebrew.mxcl.httpd.plist` exited with 5

Which is a fairly opaque Input/Output error. Following the suggestion to run the command as root, I get complaints about running as root and this

/Library/LaunchDaemons/homebrew.mxcl.httpd.plist: service already bootstrapped
Bootstrap failed: 37: Operation already in progress
Error: Failure while executing; `/bin/launchctl bootstrap system /Library/LaunchDaemons/homebrew.mxcl.httpd.plist` exited with 37

I then did I uninstall deleting the suggested directories, following a reinstall it goes back to the Bootstrap failed: 5: Input/output error

So, this is where I have ended up, a borked Apache install and not being sure where to go next...

2 Answers 2

4

I wanna share my way of possibly fixing this issue.

After hitting tail -f /usr/local/var/log/httpd/error_log, my result was:

[Thu Jan 27 16:32:18.327057 2022] [core:error] [pid 28368] (2)No such file or directory: AH00099: could not create /usr/local/var/run/httpd/httpd.pid.KMq3C9
[Thu Jan 27 16:32:18.327529 2022] [core:error] [pid 28368] AH00100: httpd: could not log pid to file /usr/local/var/run/httpd/httpd.pid
[Thu Jan 27 16:36:12.775769 2022] [core:error] [pid 122] (2)No such file or directory: AH00099: could not create /usr/local/var/run/httpd/httpd.pid.sFmHyH

So it looks like I don’t have that file created. So I created it using

mkdir /usr/local/var/run
mkdir /usr/local/var/run/httpd

Then I hit apachectl start reulting in

(13)Permission denied: AH00072: make_sock: could not bind to address 127.0.0.1:80
no listening sockets available, shutting down
AH00015: Unable to open logs

So I changed Listen 8080 row in /usr/local/etc/httpd/httpd.conf to Listen 127.0.0.1:8080

After hitting apachectl stop/start I got error saying

(13)Permission denied: AH00091: httpd: could not open error log file /usr/local/var/log/httpd/error_log.
AH00015: Unable to open logs

So I removed two files (error_log and access_log) inside /usr/local/var/log/httpd/

Then for some reason I used sudo /usr/local/bin/httpd -k start to start httpd. If that returns that process is already running, simply kill that process and start httpd again.

my /usr/local/var/log/httpd/error_log now doesn’t show any error and localhost is working fine on localhost:8080 as changed before.

And yes brew services list still shows error at httpd.

2
  • 1
    I am accepting this because it has all the diagnostic info needed. I don't really know what fixed it for me, but these would get you repeat the steps I took. Thanks!
    – nizz0k
    Jan 29, 2022 at 9:01
  • The sudo /usr/local/bin/httpd -k start part seemed to do the trick in my case.
    – Shawn W
    Feb 11, 2023 at 7:58
1

Posting my case (maybe will help somebody):

In my case tail -f /usr/local/var/log/httpd/error_log was resulting:

tail: /usr/local/var/log/httpd/error_log: No such file or directory

Anyway, I have deleted /usr/local/var/run/httpd/httpd.pid and restarted the httpd:

rm /usr/local/var/run/httpd/httpd.pid
brew services stop httpd
brew services start httpd

Then run brew services to check if it's working.

2
  • My hardware:OS monterey m1 mac mini. Install httpdvia homebrew . started as root. Its at the ~/Library plist. I wonder is it permisisons issue . Super user cannot seem to change from root to myuser
    – mark
    Jun 20, 2023 at 9:07
  • Its not resolved . I can restart httpd the next day. It is nornal to test a local host web development.
    – mark
    Jun 20, 2023 at 9:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .