LAMP 只能访问到HTML,访问不到php

做LAMP 只能访问到html文件,访问不到hph文件
防火墙已经关闭

相关配置已更改


```bash
 TypesConfig /etc/mime.types
    AddType application/x-httpd-php  .php
    AddType application/x-httpd-php-source  .phps
    DirectoryIndex  index.php index.html

首页文件也更改
```c
[root@chaogelinux ~]# cat /var/www/html/index.php
<meta charset=utf8>
我是新的首页,你好兄弟们

phpinfo();
?>





httpd 、mariadb都是正常的

日志显示:


```bash

[Wed Apr 12 17:05:38.213044 2023] [lbmethod_heartbeat:notice] [pid 2136] AH02282: No slotmem from mod_heartmonitor
[Wed Apr 12 17:05:38.225116 2023] [mpm_prefork:notice] [pid 2136] AH00163: Apache/2.4.6 (CentOS) PHP/5.4.16 configured -- resuming normal operations
[Wed Apr 12 17:05:38.225150 2023] [core:notice] [pid 2136] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'




有没有大佬遇到过的

【centos搭建好了lamp,无法访问.php文件,能访问.html文件】原文查看:https://www.cnblogs.com/zqblog1314/p/13263772.html

1、检查Apache,php和Mariadb服务是否正常运行
1.1、检查Apache服务

systemctl status httpd.service

看到   Active: active (running) 就说明运行正常。

否则开启Apache服务

systemctl enable httpd && systemctl start httpd  //开启服务,并设置开机启动

1.2检查php是否在运行

ps -ef | grep php

看到

root 4411 3967 0 22:30 pts/1 00:00:00 grep --color=auto php

就说明正常运行

1.3检查Mariadb服务

systemctl status mariadb.service

看到   Active: active (running) 就说明运行正常。

否则开启Mariadb服务

systemctl enable mariadb && systemctl start mariadb  //开启服务,并设置开机启动

2、若以上环境都正常,请尝试关闭防火墙
执行下面命令:

systemctl stop firewalld.service