【发布时间】:2017-04-22 12:28:07
【问题描述】:
第一次得到一个新的 MBP 2016。尝试设置 PHP、MySQL 和 Apache。使用命令启动 Apache
sudo apachectl restart
然后通过
安装PHPbrew install php71 --with-httpd24
还进行了以下更改...
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
DirectoryIndex index.html index.php
SetHandler application/x-httpd-php
ServerName dev-server
另外,更新主机文件/etc/hosts/
但是,每当我尝试使用命令 sudo apachectl restart 或 sudo apachectl stop 停止/重新启动我的 apache 时,我都会遇到以下错误。
AH00557: httpd: apr_sockaddr_info_get() failed for Sureshs-MacBook-Pro.local
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 not running, trying to start
但是,奇怪的是,当我从浏览器http://localhost/index.php 执行任何 PHP 文件时,它工作正常。在我的 index.php 文件中,我使用代码 <?php phpinfo(); ?> 它显示 PHP 版本 PHP Version 7.1.4 已加载。
尝试了很多,但不知道哪里出了问题。
---更新---
在我的/private/etc/hosts 文件中更新127.0.0.1 Sureshs-MacBook-Pro.local 后,解决了一个错误。现在我只得到以下错误。
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using Sureshs-MacBook-Pro.local. Set the 'ServerName' directive globally to suppress this message
【问题讨论】:
-
在您的 apache 配置中添加
serverName = my.server.name指令可能会解决您收到的警告。 -
我已经将它添加为
ServerName dev-server。看我的帖子 -
尝试不带连字符的 ServerName 值并给出端口值。例如:服务器名称 devserver:80
-
@NagaPenmetsa 我终于弄清楚了我的问题是什么。我已经在帖子中回复了答案。不过感谢您的回复。
标签: php apache homebrew macos-sierra