是否有可能包括在IIS7 HTML PHP? [英] is it possible to include php in html on IIS7?

查看:170
本文介绍了是否有可能包括在IIS7 HTML PHP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎是可能的阿帕奇这样做,

It seems to be possible to do so in Apache,

包括在HTML里面

不过,我可以让我的IIS 7解析HTML文件到PHP?目前我的HTML文件允许ASP包括像这将是辉煌的,如果我可以只是做与PHP文件。

But can I make my IIS 7 parse html files for php? Currently my html files allow asp includes like it would be splendid if I could just do that with a php file.

我的服务器上运行PHP文件,如你所愿。

My server runs .php files as you would expect.

我已经试过被添加处理程序映射在IIS与作为* .PHP映射相同的价值观这是我的IIS / PHP安装时创建,仅用于交换的.html *

What I've tried is adding a Handler Mapping in IIS with the same values as the *.php mapping that was created with my IIS/PHP install, only switched for *.html

这不工作,那么我在web.config文件中添加了一个处理程序

This didn't work, then I added a handler in my web.config file

<add name="PHP_via_FastCGI" path="*.html" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.3\php-cgi.exe" resourceType="Either" requireAccess="Script" />

这样的,而且没有任何改变。

like that, and that didn't change anything.

当我运行在它的PHP code html文件,有没有错误,code只是简单地不运行。

There are no errors when I run an html file with php code in it, the code just simply does not run.

让我们假设我不能只是简单地我的index.html更改为index.php文件。

Let's assume that I cannot just simply change my index.html to an index.php.

推荐答案

我得到这个工作了来自Apache迁移到IIS所使用的混合物网站的.php 的.html 为它的脚本。我有这个(裁剪无用的东西)在我的web.config:

I had to get this working for a site migrated from apache to IIS that used a mixture of .php and .html for it's scripts. I have this (cropped useless stuff) in my web.config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <add name="PHP53_via_FastCGI_HTML" path="*.html" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.3\php-cgi.exe" resourceType="File" requireAccess="Script" />
        </handlers>
    </system.webServer>
</configuration>

有你的右侧部分得到它?我恨,大多数的web.config的例子我看到的实际上不告诉你,你一节他们应该在&LT; /夸夸其谈&GT;

这篇关于是否有可能包括在IIS7 HTML PHP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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