index.php不能由localhost自动读取

我只是在Windows 8中手动安装Apache,PHP和MySQL。它工作正常

但问题是,当我尝试打开浏览器中的目录,它会自动打开index.html而不是index.php

例如:我有以下文件夹结构

htdocs-> folder1->的index.php

如果我访问“本地主机/ folder1 / index.php”它加载罚款,但如果我访问“本地/文件夹1”,那么它会显示该文件夹中的所有文件和文件夹。

有没有反正我可以让本地打开index.php自动打开,并不显示该文件夹内的文件?

检查DirectoryIndex指令是否正确设置在你的Apacheconfiguration文件,例如

DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm

在Apacheconfiguration文件中find您的服务器configurationDirectoryIndex定义,并将index.php添加到已经存在的任何地方。 每个虚拟主机也可以有一个DirectoryIndex。 或每个目录。 或在.htaccess中。 请参阅mod_dir directoryIndex文档