在HTML页面中嵌入PHP在Windows webmatrix2服务器 [英] embed php in html page in windows webmatrix2 server
问题描述
我试图嵌入PHP code。在我的HTML网页在我的GoDaddy的Linux的托管网站。 我知道的HOWTO来指导我如何做到这一点的godaddy的编辑我 .htaccess文件。
I am trying to embed php code in my html pages on my godaddy linux hosted site. I am aware of howtos that will instruct me how to do this on godaddy by editing my .htaccess file.
我的问题是,我想开发的本地windows下webmatrix2。
My problem is that I want to develop locally under windows webmatrix2.
什么需要下运行IIS或WebMatrix中作为服务器的Windows服务器做什么? 我GoDaddy的帐户是linux下托管的,但我在windows下开发使用WebMatrix中。
What needs to be done under a windows server running iis or webmatrix as server? My godaddy account is hosted under linux but I develop under windows using webmatrix.
解决方案我发现不工作。
Solutions I have found that don't work.
1)根据一个来源,这些行添加到对ApplicationHost.config 文件
1) According to one source add these lines to the applicationhost.config file
<add name="PHP53_via_FastCGI_html" path="*.html"
verb="GET,HEAD,POST" modules="FastCgiModule"
scriptProcessor="C:\Program Files (x86)\iis express\PHP\v5.3\php-cgi.exe"
resourceType="Either" />
在iisex preSS目录下。他们崩溃我的整个本地站点。
under the iisexpress directory. They crash my entire local site.
2)在WebMatrix中,在 web.config中文件的站点添加在此重写规则。
2) In Webmatrix, In the web.config file for the site add in this rewrite rule.
<system.webServer>
<rewrite>
<rules>
<rule name="REWRITE_TO_PHP">
<match url=".html" />
<conditions logicalGrouping="MatchAll" />
<action type="Rewrite" url=".php" />
</rule>
</rules>
</rewrite>
... more code
3),或尝试在 web.config中
<rewrite>
<rules>
<rule name="REWRITE_TO_PHP">
<match url="*.html" />
<conditions logicalGrouping="MatchAll" />
<action type="Rewrite" url="{"*.Php"} />
</rule>
</rewrite>
4),或尝试在 web.config中
<handlers>
<add name="html via php cgi" path="*.html" verb="*" modules="FastCgiModule"
scriptProcessor="C:\Program Files\Php\php-cgi.exe"
resourceType="Unspecified" />
</handlers>
无我上面的工作。 我知道所有的上面,这是一个很大的信息。这是所有我能找到冗长的网络搜索。我不是一个系统codeR靠经验。我只是需要一些 的作品,让我开始在Windows上编码的PHP在HTML中。重点突破 会,如果我开始看到我的PHP displying在关键字的颜色,并有webtrix智能感知 工作! 智能感知是伟大的! 谢谢你。
None of the above work for me. I know all of the above this is a lot of information. This is all I have been able to find in lengthy web searches. I am not a system coder by experience. I just need something that works that will allow me to start coding php in html on windows. The key breakthrough will be if I start seeing my php displying in keyword colors and have webtrix intellisense work! Intellisense is great! Thank you.
推荐答案
在你的web.config文件,你应该有
In your web.config file you should have
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="PHP_via_FastCG1" path="*.htm" verb="*" modules="FastCgiModule" scriptProcessor="C:\PHP5.5\php-cgi.exe" resourceType="Either" />
<add name="PHP_via_FastCG2" path="*.html" verb="*" modules="FastCgiModule" scriptProcessor="C:\PHP5.5\php-cgi.exe" resourceType="Either" />
</handlers>
</system.webServer>
</configuration>
其中scriptProcessor =C:\ PHP5.5 \名为php-cgi.exe是,你的PHP实际存储在系统中确定。您可以使用phpinfo()函数的一些提示在哪里,这可能是为您的系统。
Where scriptProcessor="C:\PHP5.5\php-cgi.exe" is determined by where your php is actually stored on the system. You can use phpinfo() for some hints on where this might be for your system.
这篇关于在HTML页面中嵌入PHP在Windows webmatrix2服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!