我刚刚使用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
会返回不同的网址。 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获取网址http://localhost:8000
?
好的,我发现如果我将ServerName localhost
添加到httpd.conf(在此路径/usr/local/etc/apache2/2.4/httpd.conf上)警告消失了 - 谢谢安德鲁
但是laravel仍然返回127.0.0.1 ...任何想法? 它是否在Mac上正确安装PHP 7?
答案 0 :(得分:2)
安装完成后,PHP 7 str(something2)
运行此命令brew install php71 --with-httpd24
,然后编辑macOS Apache上的httpd.conf(/etc/apache2/httpd.conf)......