0
点赞
收藏
分享

微信扫一扫

【庖丁解牛】成功解决LAMP架构中无法验证index.php的问题

杰森wang 2022-02-19 阅读 49


问题复现

安装完LAMP架构,并启动mysql和apache,并在/var/www/html下建立index.php

写入phpinfo();后,重启apache,通过浏览器访问,却发现浏览器无法访问,显示空白。

解决思路

一般出现这样的情况需要查看下防火墙和selinux是否关闭,解决任何问题都需要看是否通,如果不通,要么是权限问题,要么是防火墙问题。

问题解决

  1. 关闭防火墙和selinux
[root@gaosh-1 html]# service iptables stop
iptables:将链设置为政策 ACCEPT:filter [确定]
iptables:清除防火墙规则: [确定]
iptables:正在卸载模块: [确定]
[root@gaosh-1 html]#
[root@gaosh-1 html]# setenforce 0

查看如果还没有解决问题,可以设置配置文件

vim /etc/httpd/conf.d/php.conf

添加两行 :

AddType application/x-httpd-php .php
DirectoryIndex index.php index.htm index.html

修改完之后,重启apache

service httpd restart

然后在通过浏览器访问即可。



举报

相关推荐

0 条评论