[英]PHP 7.1 on macOS Sierra 10.12.3 - installed by Homebrew
我剛剛用 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
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 自制軟件/版本
釀造自來水自制軟件/自制軟件-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 上)警告消失了 - 謝謝安德魯
但是 Laravel 仍然返回 127.0.0.1 ... 有什么想法嗎? 在 Mac 上正確安裝 PHP 7 嗎?
安裝后 PHP 7 brew install php71 --with-httpd24
運行這個命令brew unlink httpd24
然后在 macOS Apache (/etc/apache2/httpd.conf) 上編輯 httpd.conf...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.