【发布时间】:2018-03-21 03:52:57
【问题描述】:
我正在尝试使用默认的 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.soServerName 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),它只会显示代码,而不是输出。
据我所知,我已经正确设置了所有内容。为什么我仍然会收到此错误?
【问题讨论】: