apache 无法启动httpd -执行时失败;退出时返回5

inn6fuwd  于 2022-11-16  发布在  Apache
关注(0)|答案(7)|浏览(139)

今天刚试着访问我的localhost,但它不工作。我昨天工作了,但我相信这是因为我的Mac崩溃了。我试着用brew services start httpd再次启动httpd。这导致:
引导失败:5:输入/输出错误请尝试以root用户身份重新运行该命令以获取更丰富的错误。错误:执行时失败; /bin/launchctl bootstrap gui/501 /Users/UserName/Library/LaunchAgents/homebrew.mxcl.httpd.plist退出,返回值为5。
我试过重新安装httpd,但它仍然给出同样的错误。有什么想法的原因可能?

kwvwclae

kwvwclae1#

我在升级到MacOS Monterey后也遇到了同样的问题。但是我通过这些命令解决了我的问题。

卸载自制程序.mxcl.httpd.plist

launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist

然后再次载入

launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist

之后,我使用此命令再次启动httpd。

brew services start httpd
50few1ms

50few1ms2#

我只是想把对我有用的东西分享给那些还困在...
似乎我有一个版本的apache运行,这是停止brew版本。(以为我已经删除了内置的apache!)
这也发生在我的Mac崩溃后,并得到了完全相同的错误信息,但我做到了:

完全停止brew httpd服务

brew services stop httpd

停止Mac Apache的残余

sudo apachectl -k stop

再次启动brew httpd

brew services start httpd

一开始就很有魅力,解决了我的问题。

puruo6ea

puruo6ea3#

在到处尝试了所有建议的解决方案之后,最后为我做的是将/usr/local/var/log/httpd中日志文件的所有者更改为我的用户,而不是root。
sudo chown [username] *
这花了我几个小时才弄清楚,可悲的是-我甚至删除和重新安装httpd(这实际上是一件好事,因为有一个n旧版本的桶敲周围回来)。

pkmbmrz7

pkmbmrz74#

所以在尝试了很多方法之后,这个方法似乎奏效了:
尝试Volex在这里建议的(brew services. Cant start service. get "Bootstrap failed: 5: Input/output error")给了我一个更精确的错误消息。
新的错误消息使我看到以下内容:apache doesn't work after upgrade of macOs Sierra brew reinstall apr-util修复了此问题。

kuuvgm7e

kuuvgm7e5#

我有同样的问题后,任何重新启动我的MacBook.我使用的MacBook Air M1和蒙特雷OS版本.
我已经用这4个命令解决了我的问题
首次运行时:

sudo apachectl -k stop

然后运行以下三个命令:(注意:不要以sudo身份运行)

launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist

launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist

brew services start httpd

然后您可以看到运行服务的命令如下:

brew services list
g2ieeal7

g2ieeal76#

在某些情况下将有助于重新启动HTTPD。

brew services restart httpd

当我的电脑因为某种原因崩溃,httpd正在运行,但是localhost已经“关闭”了。或者你可以停止httpd并重新启动电脑。然后启动httpd就可以了。

mftmpeh8

mftmpeh87#

对我来说,我得到了相当相同的问题,一旦我试图启动postgresql忘记了我已经启动了它,停止后,再次启动它的工作

user@users-MacBook-Pro ~ % brew services start postgresql
Warning: Use postgresql@14 instead of deprecated postgresql
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/user/Library/LaunchAgents/homebrew.mxcl.postgresql@14.plist` exited with 5.
user@users-MacBook-Pro ~ % brew services stop postgresql 
Warning: Use postgresql@14 instead of deprecated postgresql
Stopping `postgresql@14`... (might take a while)
==> Successfully stopped `postgresql@14` (label: homebrew.mxcl.postgresql@14)
user@users-MacBook-Pro ~ % 
user@users-MacBook-Pro ~ % brew services start postgresql
Warning: Use postgresql@14 instead of deprecated postgresql
==> Successfully started `postgresql@14` (label: homebrew.mxcl.postgresql@14)
user@users-MacBook-Pro ~ %

相关问题