Could not reliably determine the server's fully qualified domain name for MacBook

纵饮孤独 提交于 2019-12-29 05:22:07

问题


First time got a new MBP 2016. Trying to setup PHP,MySQL & Apache. Started Apache by using command

sudo apachectl restart

Then installed PHP by

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

Also, updated the same in host file /etc/hosts/

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

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.

---UPDATE---

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

回答1:


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.

Also, for Apache start/restart/stop following command sudo /usr/sbin/apachectl start works for me.




回答2:


As per message:

Set the 'ServerName' directive globally to suppress this message.

You need to identify httpd.conf Apache configuration file by:

apachectl -t -D DUMP_INCLUDES

then edit it and uncomment the line with ServerName (make sure it has the valid server name). E.g.

ServerName localhost



回答3:


open file httpd.conf

vi /etc/httpd/conf/httpd.conf

add to first line

ServerName localhost

systemctl restart httpd




回答4:


I resolved this issue changing the port address in the httpd.conf file in windows.

This problem arises due to the port already listening, which we use in the conf file.

To view the port listening, use the command "netview /a"

if the port used in the conf file already listening, change to different one(e.g, 8080)

set servername to "localhost" or 127.0.0.1

Now start the apache server "httpd.exe -k start"

it will work fine.



来源:https://stackoverflow.com/questions/43559201/could-not-reliably-determine-the-servers-fully-qualified-domain-name-for-macboo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!