【问题标题】:Ubiquitous "apr_sockaddr_info_get() failed" error with default Apache and Homebrew PHP 7.0 on SierraSierra 上的默认 Apache 和 Homebrew PHP 7.0 普遍存在“apr_sockaddr_info_get() failed”错误
【发布时间】: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.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.phpphpinfo.php~/Sites),它只会显示代码,而不是输出。

据我所知,我已经正确设置了所有内容。为什么我仍然会收到此错误?

【问题讨论】:

    标签: php macos apache


    【解决方案1】:

    原来问题是一个杂散的httpd.conf。我一直在尝试使用 Homebrew 的 httpd,但没有任何运气,所以我回到了默认的 Apache。当我查看配置文件的路径时,我没有注意到它是从 /usr/local/ 读取的。一旦我清理了文件并确保正在读取正确的 conf 文件,错误就消失了。

    【讨论】:

      猜你喜欢
      • 2017-12-12
      • 2018-11-03
      • 2017-04-22
      • 2019-01-31
      • 2011-10-03
      • 2017-09-27
      • 2018-11-16
      • 2017-06-19
      • 2019-03-09
      相关资源
      最近更新 更多