apache环境配置 | httpd Could not reliably determine the server's fully qualified domain name

 
 转 https://blog.csdn.net/u012104219/article/details/79853797

前言

作为php开发者,你是否遇到这种情况。经常我们会在Linux系统上通过php do.php命令进行程序调试。有时候明明通过命令行方式调试程序成功后,却发现在浏览器请求我们的www.test.com/../do.php却不能够成功执行,报500错误。

这时候执行service httpd restart重启web服务

启动apache遇到错误:“Starting httpd: httpd Could not reliably determine the server’s fully qualified domain name, using localhost.localdomain for ServerName”。 
其实浏览器出现500错误,意味着你没有配置服务可依靠的域名,无需改动你的程序,只要修改配置文件即可。

哎,第一次遇到这个问题,最近还是用的VPN连上服务器,还一直以为是网络的问题,晕死了。。。好难过,不过还好解决了,特别记录这篇博文以便备忘和学习。

正确解决的步骤

1.打开你的httpd.conf配置文件(我的环境环境:vi /etc/httpd/conf/httpd.conf),如果不知道httpd.conf文件在哪里,可以通过打印phpinfo()函数来查看,或者cd /之后通过’locate php.ini’命令进行查找定位。

2.编辑httpd.conf文件,搜索”#ServerName”,添加ServerName localhost:80

[root@server conf]# ls
extra httpd.conf magic mime.types original
[root@server conf]# vi httpd.conf
#ServerName www.example.com:80
ServerName localhost:80
  • 1
  • 2
  • 3
  • 4
  • 5

3.重启服务service httpd restart提示如下两个OK则配置成成功。

Stopping httpd: [  OK  ]
Starting httpd: [ OK ]
  • 1
  • 2

4.在浏览器打开你的网页,即可成功运行。

5.php如何开启报错提醒? 
* 修改php.ini文件,display_errors = Off修改为display_errors = On

参考资料

联系作者

如果你觉得不错的话,不妨打赏一下,这样我就有更大的动

apache环境配置 | httpd Could not reliably determine the server's fully qualified domain name的更多相关文章

  1. 测试Apache服务器及httpd: Could not reliably determine the server's fully qualified domain name解决办法

    测试Apache服务器: 重启apache: sudo /usr/local/apache/bin/apachectl restart 若出现错误: httpd: Could not reliably ...

  2. 解决Apache启动错误:httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

    启动apache遇到提示: [root@bqh-119 conf]# ../bin/apachectl -thttpd: apr_sockaddr_info_get() failed for bqh- ...

  3. 源码安装Apache,报错:Cannot use an external APR with the bundled APR-util和httpd: Could not reliably determine the server's fully qualified domain name, using

    一.解决APR和APR-util错误: 1.1.安装APR: [root@ganglia httpd-2.2.23]# cd srclib/apr [root@ganglia apr]# ./conf ...

  4. apache状态显示报错AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdo...is message

    今天启动apache查看状态发现报错,说不能确认服务器完全确认域名,以下是报错内容: [root@localhost ~]# service httpd status Redirecting to / ...

  5. 重启Apache报错apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName ... waiting的解决方法

    启动apache提示 : apache2: Could not reliably determine the server's fully qualified domain name, using 1 ...

  6. Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name

    启动apache的时候,报告以下消息提示: Starting httpd: httpd: Could not reliably determine the server's fully qualifi ...

  7. 解决apache启动错误:Could not reliably determine the server's fully qualified domain name

    启动apache遇到错误:httpd: Could not reliably determine the server's fully qualified domain name [root@serv ...

  8. apache启动错误:Could not reliably determine the server's fully qualified domain name

    启动apache遇到错误:httpd: Could not reliably determine the server's fully qualified domain name [root@serv ...

  9. Starting httpd:Could not reliably determine the server's fully qualified domain name

    #service httpd start #Starting httpd: httpd: Could not reliably determine the server's fully qualifi ...

随机推荐

  1. iOS 上线过程中出现的问题总结

    1:  因为使用后台播放音乐,在 info 里面添加 required background modes  的 key, 如果你的代码里面没有后套播放音频的功能, 不要添加 required back ...

  2. swift 学习- 13 -- 下标

    // 下标 可以定义在 类, 结构体, 和 枚举 中, 是访问集合, 列表或 序列中元素的快捷方式, 可以使用下标的索引, 设置 和 获取值, 而不需要再调用对应的存取方法, 举例来说, 用下标访问一 ...

  3. Confluence 6 启用 HTTP 压缩

    在屏幕的右上角单击 控制台按钮 ,然后选择 基本配置(General Configuration) 链接. 在左侧的面板中选择 通用配置(General Configuration). 启用 HTTP ...

  4. 【Java】「深入理解Java虚拟机」学习笔记(4)- 类文件结构

    我为什么喜欢Java,另一个重要原因就是跨平台,WORA. 程序员是爽了,但肯定有人要为你遮风挡雨,解决WORA的基石就是字节码+虚拟机. ♣Tip 其实这里存在两种无关性,一是平台无关性.另一个是语 ...

  5. java和python对比----1:

    对计算来说: java 除法: 3/4 ==0; pyhton 除法: 3/4 ==0 3//4==0.75

  6. CF558E

    非常好的一道题,是线段树的常见玩法 将字符串转化为1~26个数 对区间开一棵线段树,用两个数组分别维护区间中1~26每个数的个数以及一个区间覆盖标记,表示这个区间是否被某一个值覆盖了 在每次排序时,首 ...

  7. centos7.5上一步步部署jumpserver

    1.基础环境:centos7.5:关闭防火墙和selinux 2.修改字符集,否则可能会报input/output error 的问题,因为日志里打印了中文 [root@xzw ~]# localed ...

  8. 备份还原数据数据库(固定IP版)

    1.新建data文件夹,用于存放备份数据 2.新建db文件夹,用于存放初建数据库为脚本 3.首次使用双击export.bat进行备份数据库: 4.以后每次使用双击setup.bat进行还原数据库: 备 ...

  9. 【转】asp.net Core 系列【一】——创建Web应用

    ASP.NET Core 中的 Razor 页面介绍 Razor 页面是 ASP.NET Core MVC 的一个新功能,它可以使基于页面的编码方式更简单高效. 若要查找使用模型视图控制器方法的教程, ...

  10. tomcat和server安装和操作

    servers的创建 最后一步:ctrl+s