简体   繁体   中英

PHP 7.1 on macOS Sierra 10.12.3 - installed by Homebrew

I've just installed PHP 7.1 with Homebrew and when I type to Terminal $ sudo apachectl restart it returns 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 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 but everything seems to be working well.

phpinfo(); returns normal results...

php artisan serve returns different URL. http://127.0.0.1:8000 instead of http://localhost:8000 ...

PHP installation steps:

brew tap homebrew/dupes

brew tap homebrew/versions

brew tap homebrew/homebrew-php

brew install php71 --with-httpd24

In httpd file:

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>

What should I do to avoid this error message?

And how can I get the URL http://localhost:8000 from Laravel back?

Ok, I found if I add ServerName localhost to the httpd.conf (on this path /usr/local/etc/apache2/2.4/httpd.conf) the warning is gone - thank you to Andrew

But laravel still return 127.0.0.1... any ideas? Is it correct installation of PHP 7 on Mac?

安装后 PHP 7 brew install php71 --with-httpd24运行这个命令brew unlink httpd24然后在 macOS Apache (/etc/apache2/httpd.conf) 上编辑 httpd.conf...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM