簡體   English   中英

如何配置WebMatrix以在* .htm,* .html文件上運行PHP?

[英]How do you configure WebMatrix to run PHP on *.htm, *.html files?

我正在使用WebMatrix在本地運行PHP網站。 該站點在* .html文件中使用PHP。 默認情況下,WebMatrix不允許這樣做。 如何配置WebMatrix以便PHP運行?

(注意我正在回答我自己的問題)

您需要編輯該文件:

%USERPROFILE%\Documents\IISExpress\config\applicationhost.config

(例如,“C:\\ Users \\ Marcus \\ Documents \\ IISExpress \\ config \\ applicationhost.config”)

你會注意到這樣的一行:

<add name="PHP53_via_FastCGI" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\iis express\PHP\v5.3\php-cgi.exe" resourceType="Either" />

您可以通過添加新行添加其他文件擴展名:

<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" />
<add name="PHP53_via_FastCGI_htm" path="*.htm" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\iis express\PHP\v5.3\php-cgi.exe" resourceType="Either" />

為每個<add />元素賦予唯一的“名稱”屬性非常重要。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM