【问题标题】:only file name index.php is not working on apache2只有文件名 index.php 不适用于 apache2
【发布时间】:2023-04-08 00:57:01
【问题描述】:

我在 ubuntu 上使用 apache2。我的本地主机工作正常,php 也正常工作。

但只有文件名 index.php 不起作用。如果文件名是 test.php 或 index.php 以外的任何其他名称,它可以工作。

不知道是apache prob还是php,谁能帮忙?

谢谢, 卡米尔

【问题讨论】:

    标签: php apache ubuntu apache2 ubuntu-12.04


    【解决方案1】:

    避免使用 htaccess 文件并编辑 http.conf。它也应该是相同的列表 DirectoryIndex 那里。添加 index.php 看看能不能得到 php 来渲染。

    出于好奇,您在查看 index.html 时看到了什么?有用! ?

    【讨论】:

    • 谢谢,DirectoryIndex 不在 httpd.conf 文件中。没有工作
    • 某处会有一个。如果它是 apache2,那么您可能在某处有一个带有默认 .conf 文件的站点文件夹。把这样的东西放在那里 DirectoryIndex index.php index.html
    【解决方案2】:

    你的意思是它不被识别?您可以尝试将其添加到您的网络服务器根目录中的 .htaccess 文件中:

    DirectoryIndex index.php
    

    【讨论】:

    猜你喜欢
    • 2013-11-09
    • 1970-01-01
    • 1970-01-01
    • 2010-12-20
    • 2013-12-14
    • 2019-07-08
    • 1970-01-01
    • 1970-01-01
    • 2015-05-16
    相关资源
    最近更新 更多