[英]Ubiquitous “apr_sockaddr_info_get() failed” error with default Apache and Homebrew PHP 7.0 on Sierra
我正在嘗試使用默認的Apache和Homebrew PHP(php70公式)在Mac Sierra上使用Homebrew設置簡單的Apache和PHP 7.0,並且遇到了普遍存在的錯誤:
AH00557: httpd: apr_sockaddr_info_get() failed for myMachineName
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
我已經閱讀了很多關於此錯誤的文章,並且所有建議的內容都無法正常工作。 以下是有關我設置的詳細信息:
在httpd.conf中:
DocumentRoot
設置為~/Sites
目錄( /Users/myUserName/Sites
) <Directory /Users/myUserName/Sites>
LoadModule php7_module /usr/local/Cellar/php70/7.0.23_15/libexec/apache2/libphp7.so
ServerName localhost:80
我用brew install php70 --with-apache
安裝了PHP,所以/libexec
目錄(因此libphp70.so
)就在那里。
在主機中:
127.0.0.1 localhost
我還驗證了我正在使用以下兩個命令編輯適當的httpd.conf
文件:
whereis httpd (/usr/sbin/httpd)
/usr/sbin/httpd -V
如果我運行apachectl configtest
,它將在兩個主要錯誤之后返回“ Syntax OK
”,因此httpd.conf
中沒有任何錯誤。
當我轉到http:// localhost時 ,我從該目錄獲取index.php
(和index.html
)。 但是,如果我轉到http://localhost/phpinfo.php ( phpinfo.php
在~/Sites
),它只會顯示代碼,而不是輸出。
據我所知,我已經正確設置了所有內容。 為什么我仍然會收到此錯誤?
原來問題出在httpd.conf。 我一直在嘗試使用Homebrew的httpd,但沒有運氣,因此我使用了默認的Apache。 當我查看配置文件的路徑時,我沒有注意到它是從/ usr / local /中讀取的。 一旦我清理了文件並確保讀取了正確的conf文件,該錯誤就消失了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.