php - HTML 文件正在下载而不是在 apache 服务器 (AMPPS) 上打开

标签 php html apache http ampps

昨天我在玩我的 apache 服务器的 http.conf 文件,让它在 html 中编译 php,它工作正常,所有文件打开都没有问题,但是今天它一直在下载 html 文件而不是打开它们,只有php 文件正在运行

我的配置如下:

  <IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types

#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
RemoveHandler .html .htm 
AddType application/x-httpd-php5 .html .htm
AddType application/x-tar .tgz
AddType image/x-icon .ico
AddType application/vnd.wap.wmlc .wmlc
AddType application/x-httpd-php .phtml .pwml .php5 .php4 .php3 .php2 .php .inc
AddType text/vnd.wap.wml .wml
AddType text/vnd.wap.wmlscript .wmls
AddType text/vnd.wap.wmlscriptc .wmlsc
AddType image/vnd.wap.wbmp .wbmp

#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
AddHandler cgi-script .cgi .pl

# For type maps (negotiated resources):
#AddHandler type-map var

#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

P.s “RemoveHandler .html .htm”行是我昨天添加的行之一,以便它在 html 中编译 php,我尝试删除它但仍然相同。

最佳答案

我发现了问题,这个 //AddType application/x-httpd-php .html .htm//丢失

关于php - HTML 文件正在下载而不是在 apache 服务器 (AMPPS) 上打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36893874/

相关文章:

html - float 元素会导致父元素折叠。 HTML/CSS

apache - 如何在 CentOS 版本 6 中安装 Apache2::AuthCookie?

apache - 无法提供目录/var/www/html/: No matching DirectoryIndex

javascript - 通过 AJAX 使用 JQuery 获取 HTML id

javascript - 包含 ng-model 和 ng-repeat 后切换开关不切换

php - PayPal PHP SDK - 不返回 GET 变量 'success'

css - 为什么居中的 HTML DIV 会根据其内容移动?

facebook - 使用 apache 和 tomcat 在同一台服务器上托管 facebook 应用程序和网站

php - 从 PHP 数组获取值并显示它们

php - 将 php 中 json_encode 的结果传递给 javascript,然后将其传递给另一个 javascript 函数