【问题标题】:How to completely uninstall Homebrew Apache httpd24?如何完全卸载 Homebrew Apache httpd24?
【发布时间】:2017-05-01 22:45:31
【问题描述】:

在 macOS Sierra 上,我使用 Homebrew 安装了 Apache:

$ brew install httpd24

这导致了一些奇怪的 Apache 问题。似乎 macOS Sierra 上的默认安装 Apache 在某种程度上仍然处于活动状态。我现在想完全卸载 httpd24,但仍然在我的进程中看到它。这是我所做的:

$ brew unlink httpd24 $ brew uninstall httpd24 $ rm -rf /usr/local/etc/apache2/

运行$ ps aux|grep httpd 揭示:

blt              51473   0.0  0.0  2613988    844   ??  S    10:48PM   0:00.00 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt              51447   0.0  0.0  2613988    892   ??  S    10:47PM   0:00.00 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt              51396   0.0  0.0  2613988    856   ??  S    10:47PM   0:00.00 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt              51345   0.0  0.0  2613988    844   ??  S    10:47PM   0:00.00 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt              51285   0.0  0.0  2613988    876   ??  S    10:45PM   0:00.00 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt              51048   0.0  0.0  2615200    868   ??  S    10:34PM   0:00.00 /usr/sbin/httpd -T
blt              51047   0.0  0.0  2615200    840   ??  S    10:34PM   0:00.00 /usr/sbin/httpd -T
blt              51046   0.0  0.1  2628716  20104   ??  S    10:34PM   0:00.06 /usr/sbin/httpd -T
blt              51045   0.0  0.1  2628716  20084   ??  S    10:34PM   0:00.05 /usr/sbin/httpd -T
blt              51044   0.0  0.1  2628716  20148   ??  S    10:34PM   0:00.04 /usr/sbin/httpd -T
blt              51043   0.0  0.1  2628716  20236   ??  S    10:34PM   0:00.05 /usr/sbin/httpd -T
blt              51041   0.0  0.1  2628716  20668   ??  S    10:34PM   0:00.07 /usr/sbin/httpd -T
blt              51040   0.0  0.4  2644668  59852   ??  S    10:34PM   0:01.05 /usr/sbin/httpd -T
root             47136   0.0  0.1  2615456  18872   ??  Ss    5:34PM   0:00.67 /usr/sbin/httpd -T
root             43442   0.0  0.0  2614244   7172   ??  Ss    4:14PM   0:00.83 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt              52451   0.0  0.0  2423384    256 s003  R+   11:06PM   0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn httpd

路径为/usr/sbin/httpd 的进程是默认的Apache 安装。路径为/usr/local/Cellar/httpd24/2.4.23_2/bin/httpd 的是 Homebrew 安装。这甚至不应该是可能的。目录/usr/local/Cellar/httpd24 甚至不存在。我曾尝试手动杀死这些进程,但它们最终会回来。我已尝试重新启动计算机。我已经无数次地重新启动了 Apache。我已经确认使用$ apachectl 在命令行上与之交互的Apache 是默认安装。我不知道还能做什么。感谢您的帮助。

【问题讨论】:

  • 鉴于它在重新启动后仍然存在。您是否检查了 ~/Library/LaunchAgents/Library/LaunchDaemons/Library/LaunchAgents 是否有任何可能的 Homebrew httpd24 安装剩余?

标签: apache homebrew uninstallation httpd.conf macos-sierra


【解决方案1】:

我不记得我究竟做了什么来解决这个问题,但我拼凑了一个 bash 别名,它可能对使用 Homebrew PHP 但默认 Mac OS Apache 的其他人有用。它将停止 Apache,终止任何 Homebrew Apache (httpd24) 进程,取消链接并卸载 Homebrew Apache,然后重新启动剩余的默认 Apache 安装。有时我必须在使用 Homebrew 安装新的 PHP 版本后使用它。有关详细信息,请参阅此问题:https://github.com/Homebrew/homebrew-php/issues/3601

alias fix_apache='sudo apachectl stop; sudo pkill -f /usr/local/Cellar/httpd24; sudo pkill -f /usr/sbin/httpd; sudo pkill -f /usr/local/opt/httpd24; brew unlink httpd24; brew uninstall --ignore-dependencies --force httpd24; sudo apachectl start;'

【讨论】:

  • httpd24 现已弃用,请考虑升级您的脚本。
【解决方案2】:

我遇到了同样的问题,并按照@maskedjellybean 的回答,根据@pilot 评论升级了httpd 的脚本(我目前使用的是2.4.48 版)。

代码如下:

alias fix_apache='sudo apachectl stop; sudo pkill -f /usr/local/Cellar/httpd; sudo pkill -f /usr/sbin/httpd; sudo pkill -f /usr/local/opt/httpd; brew unlink httpd; brew uninstall --ignore-dependencies --force httpd; sudo apachectl start;'

一切都很完美。

【讨论】:

    猜你喜欢
    • 2015-03-02
    • 2017-11-25
    • 2018-09-26
    • 2013-01-20
    • 2017-03-07
    • 1970-01-01
    • 1970-01-01
    • 2021-10-16
    • 2014-08-26
    相关资源
    最近更新 更多