【发布时间】:2017-06-19 17:04:06
【问题描述】:
我刚刚使用 Homebrew 安装了 PHP 7.1,当我在终端输入 $ sudo apachectl restart 时,它会返回此消息 AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.3.1.156. Set the 'ServerName' directive globally to suppress this message,但一切似乎都运行良好。
phpinfo(); 返回正常结果...
php artisan serve 返回不同的 URL。 http://127.0.0.1:8000 而不是 http://localhost:8000...
PHP安装步骤:
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew install php71 --with-httpd24
在 httpd 文件中:
LoadModule php7_module /usr/local/opt/php71/libexec/apache2/libphp7.so
<IfModule php7_module>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
</IfModule>
我应该怎么做才能避免这个错误信息?
我怎样才能从 Laravel 中获取 URL http://localhost:8000?
好的,我发现如果我将 ServerName localhost 添加到 httpd.conf(在此路径 /usr/local/etc/apache2/2.4/httpd.conf 上),警告就消失了 - 谢谢 Andrew
但是 laravel 仍然返回 127.0.0.1... 有什么想法吗? 在 Mac 上安装 PHP 7 是否正确?
【问题讨论】:
-
Here's 可能会对您有所帮助。它适用于 ubuntu,但总体问题是一样的。
-
感谢您的回复...但什么也没发生。我可以试试重启电脑...
-
我第一次编辑了错误的httpd.conf...谢谢安德鲁,我将它添加到这个问题...
标签: php configuration homebrew httpd.conf macos-sierra