【问题标题】:Wamp Server Not Parsing htm Files As PHPWamp 服务器不将 htm 文件解析为 PHP
【发布时间】:2014-10-24 09:26:38
【问题描述】:

我知道这个问题已经被问过here。我正在尝试在我的本地主机中使用脚本。该脚本包含 .htm 文件和一个 .htaccess 文件,其中包含以下代码以将这些 .htm 文件解析为 PHP。

AddHandler application/x-httpd-php5 .htm .php .html

现在这根本不起作用,每当我从本地主机运行它时,我都会得到一个空白网页。即“localhost/paystill_enterprise”,它给了我空白网页。

现在我已经尝试了所有可以在互联网上找到的解决方案,例如编辑 httpd.conf 文件等。以下是我尝试过的一些解决方案。

1-我已经尝试编辑httdp.conf,并一一添加了以下代码

 <IfModule mime_module>
  AddType application/x-httpd-php .php
  AddType application/x-httpd-php .html
  AddType application/x-httpd-php .htm
  AddType application/x-httpd-php .txt
 </IfModule>

 <FilesMatch "\.html$">
   ForceType application/x-httpd-php
 </FilesMatch>

 <FilesMatch "\.htm$">
    ForceType application/x-httpd-php
 </FilesMatch>

2- 尝试在我的 .htaccess 文件中一一添加这些代码行

 AddType application/x-httpd-php .html .htm

 AddType application/x-httpd-php5 .html .htm

 RemoveHandler .html .htm
 AddType application/x-httpd-php .php .htm .html

无论我使用什么,总是为“localhost/paystill_enterprise”获得一个空白页面。

注意: 有时,当我输入地址“localhost/paystill_enterprise”时,浏览器会要求我保存文件,即浏览器尝试下载它。 有什么建议吗?

【问题讨论】:

  • 这个问题似乎是题外话,因为它是针对webmasters

标签: apache wamp


【解决方案1】:

有一次我这样做只是将这两条指令添加到我的.htaccess 文件中。

AddHandler application/x-httpd-php .html
DirectoryIndex index.html index.php

因此,请删除所有其他更改并尝试仅此一项更改,因为您的其他更改可能会干扰此更改。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-09-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-07
    • 2012-06-21
    • 1970-01-01
    相关资源
    最近更新 更多