HTML解析不作为PHP的WAMP [英] html not parsing as php in wamp

查看:280
本文介绍了HTML解析不作为PHP的WAMP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的这个片段在我的.htaccess文件来解析HTML作为PHP的:

I am using this snippet in my .htaccess file to parse html as php:

<FilesMatch "\.(html|htm|txt)$">
 SetHandler application/x-httpd-php5
</FilesMatch>

这是工作的罚款在我的网站(在网上),但不是在我的本地主机(使用WAMP最新版).. 但如果我改变上述code到:

this is working fine in my website(online) but not in my localhost (using WAMP latest version).. but if I change the above code to:

<FilesMatch "\.(html|htm|txt)$">
 SetHandler application/x-httpd-php
</FilesMatch>

那么,这是工作在我的本地主机的罚款,但不是在我的网站.. 我要补充/删除 5 SetHandler应用/ X的httpd - PHP 来在任何一方的工作。

then, this is working fine in my localhost but not in my website.. I have to add/remove the 5 in SetHandler application/x-httpd-php to work in either one side.

请帮我..

推荐答案

您可以编辑您的本地httpd.conf文件,并添加你需要的MIME模块:

You can edit your local httpd.conf file, and add the mime modules you need:

<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>

这应该为您的本地主机。如果你不能配置你的服务器就这样了,因为你的.htaccess那里工作,使用的.htaccess配置您的服务器只。

This should work for your local host. If you can't configure your server this way, and since your .htaccess works there, use the .htaccess config for your server only.

这篇关于HTML解析不作为PHP的WAMP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆