我在 OSX 10.9 上使用 Homebrew 安裝了 Apache 2.2,它運作得很好,直到我本週末升級到 Yosemite。
sudo apachectl start
ps aux | grep httpd
ps aux | grep apache
sudo /usr/local/Cellar/httpd22/2.2.27/bin/httpd -k start
他們都沒有返回任何內容。
sudo apachectl
返回:
Usage: /usr/local/Cellar/httpd22/2.2.27/bin/httpd [-D name] [-d directory] [-f file]
[-C "directive"] [-c "directive"]
[-k start|restart|graceful|graceful-stop|stop]
[-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S]
知道我可以查看哪個文件來查看是否有任何錯誤嗎?MAMP Pro 似乎有類似的問題,可透過將 envvars 重新命名為 _envvars 來解決。我嘗試了一下,但沒有成功。
如果您需要更多詳細信息,請告訴我。
答案1
我應該先這樣做,但我終於看了一下/usr/local/var/log/apache2/error_log
,看到了這個:
[Tue Jan 27 14:56:07 2015] [error] (2)No such file or directory: could not create /usr/local/var/run/apache2/httpd.pid
[Tue Jan 27 14:56:07 2015] [error] httpd: could not log pid to file /usr/local/var/run/apache2/httpd.pid
顯然這就是問題所在......我創建了資料夾/usr/local/var/run/apache2/
,瞧!
答案2
試試這個,
brew update
brew doctor
brew reinstall php53 --with-mysql --with-pgsql --with-apache
sudo apachectl -k restart
如果您願意,可以在這裡查看完整的帖子:
http://benedmunds.com/php/2014/10/16/fixing-homebrew-php-apache-after-yosemite/