酸菜包云 2023-04-12 17:37 采纳率: 0%
浏览 8

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>
我是新的首页,你好兄弟们
<?php
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'




有没有大佬遇到过的
  • 写回答

1条回答 默认 最新

  • bluetata 云计算领域优质创作者 2023-04-13 16:00
    关注

    【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
    
    评论 编辑记录

报告相同问题?

问题事件

  • 创建了问题 4月12日

悬赏问题

  • ¥15 35114 SVAC视频验签的问题
  • ¥15 impedancepy
  • ¥15 在虚拟机环境下完成以下,要求截图!
  • ¥15 求往届大挑得奖作品(ppt…)
  • ¥15 如何在vue.config.js中读取到public文件夹下window.APP_CONFIG.API_BASE_URL的值
  • ¥50 浦育平台scratch图形化编程
  • ¥20 求这个的原理图 只要原理图
  • ¥15 vue2项目中,如何配置环境,可以在打完包之后修改请求的服务器地址
  • ¥20 微信的店铺小程序如何修改背景图
  • ¥15 UE5.1局部变量对蓝图不可见