无法可靠地确定MacBook的服务器全限定域名 [英] Could not reliably determine the server's fully qualified domain name for MacBook
问题描述
第一次获得了新的MBP2016.正在尝试设置PHP,MySQL&阿帕奇使用命令启动Apache
First time got a new MBP 2016. Trying to setup PHP,MySQL & Apache. Started Apache by using command
sudo apachectl restart
然后通过
brew install php71 --with-httpd24
还做了以下更改...
Also did following changes...
#
# 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/
Also, updated the same in host file /etc/hosts/
但是,每当我尝试使用命令sudo apachectl restart
或sudo apachectl stop
停止/重新启动apache时,都会遇到以下错误.
But, whenever I'm trying to Stop/Restart my apache by using command sudo apachectl restart
or sudo apachectl stop
I'm getting following errors.
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
已加载.
But, strangely when I'm executing any PHP file from my browser http://localhost/index.php
it's working fine. As in my index.php file I'm using code <?php phpinfo(); ?>
It's showing PHP version PHP Version 7.1.4
loaded.
尝试了很多,但没有发现哪里出了什么问题.
Tried a lot but no clude what's going wrong at where.
---更新---
在我的/private/etc/hosts
文件中更新127.0.0.1 Sureshs-MacBook-Pro.local
之后,解决了一个错误.现在,我只得到一个下面的错误.
After updating 127.0.0.1 Sureshs-MacBook-Pro.local
in my /private/etc/hosts
file, one error solved. Now I'm getting only one below error.
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
推荐答案
最后,我通过更新文件/usr/local/etc/apache2/2.4/httpd.conf
上的ServerName localhost:8080
解决了这一问题.这是一个我不知道的不同的httpd.conf文件.
Finally, I solved this by updating ServerName localhost:8080
on file /usr/local/etc/apache2/2.4/httpd.conf
. It was a differnt httpd.conf file which I didn't knew about it.
此外,对于Apache start/restart/stop
,以下命令sudo /usr/sbin/apachectl start
对我也适用.
Also, for Apache start/restart/stop
following command sudo /usr/sbin/apachectl start
works for me.
这篇关于无法可靠地确定MacBook的服务器全限定域名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!