2016-12-16 153 views
7

在MacOS塞拉利昂,我安裝的Apache使用自制:如何完全卸載Homebrew Apache httpd24?

$ brew install httpd24

這引起了一些奇怪的Apache問題。看來,在macOS Sierra上Apache的默認安裝仍然以某種方式激活。我現在想徹底卸載httpd24,但我仍然在我的進程中看到它。下面是我所做的:

$ brew unlink httpd24 $ brew uninstall httpd24

運行$ 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是​​默認安裝。我不知道還有什麼要做。感謝您的任何幫助。

+1

考慮到它在重新啓動後仍然存在。您是否檢查過任何可能的Homebrew httpd24安裝剩餘物的'〜/ Library/LaunchAgents'和'/ Library/LaunchDaemons'和'/ Library/LaunchAgents'? – Montmons

回答

2

我記不清我究竟做了什麼來解決這個問題,但是我拼湊了一個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;' 
+0

httpd24現已棄用,請考慮升級腳本。 – pilot