`
netatomy
  • 浏览: 46817 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

Creating PHP Websites with WebMatrix

 
阅读更多

Note: WebMatrix now supports PHP "out of the box". You no loger need to do any manual configuration (as detailed in this post) to get PHP support in WebMatrix. For more information, seehttp://www.microsoft.com/web/webmatrix/features.aspx.

Last week, Scott Guthrie (Corporate VP in Microsoft's Developer Division)announced on his blog the beta release of WebMatrix. His postdescribes whatWebMatrixis and how to get started with it, but he focuses mainly on .NET developers. However,hedoes hint at PHP support, particularly support for PHP applications that are available in theWeb Application Gallery. Ruslan Yakushev followed up with a blog post that delved a bit deeper into PHP support in WebMatrix:Install PHP Applications with WebMatrix. As I read those posts (andothers), I was left wondering about the extent of PHP support in WebMatrix (which is what I'll look at in this post). As it turns out, PHP is fully supported, but it requires a little bit of work up front in this beta release of WebMatrix (a smoother experience for PHP developers is planned for the final release). If you want to work on any of the PHP applications that are available in theWeb Application Gallery, the experience is very smooth – just follow Ruslan's blog post. However, if you just want to see how WebMatrix works as a PHP IDE for building your own sites (and you don’t want to install one of the PHP apps in the app gallery), then here’s what to do:

1.Download the Web Platform Installer 3 beta here:http://www.microsoft.com/web/webmatrix/

2.Run the Web PI and clickInstall Microsoft WebMatrixon theGetting Startedtab. Or, if you want to also install other programs, selectMicrosoft WebMatrix Betaon theWhat’s Newtab, then select other programs before proceeding.

image

3.Launch WebMatrix and click onSite From Template:

image

4.Select anEmpty Siteand provide a name for the site (I’m calling my “PHPSite”).

image

5.In a text editor, open theapplicationhost.configfile located in yourDocuments\IISExpress8\configdirectory. Replace the<fastcgi />element with the following element:

<fastCgi>
<application fullPath="C:\PHP\php-cgi.exe"
activityTimeout="600"
requestTimeout="600"
instanceMaxRequests="10000">
<environmentVariables>
<environmentVariable name="PHP_FCGI_MAX_REQUESTS"
value="10000" />
<environmentVariable name="PHPRC"
value="C:\PHP" />
</environmentVariables>
</application>
</fastCgi>

Note: thefullpathattribute of theapplicationelement should point to the cgi executable of your PHP installation. The value attribute for the PHPRC environment variable should point to the location of your PHP installation.

6.Add the following location element as the last child of theconfigurationelement:

<location path="PHPSite">
<system.webServer>
<handlers>
<add name="PHP via FastCGI"
path="*.php" verb="*"
modules="FastCgiModule"
scriptProcessor="C:\PHP\php-cgi.exe"
resourceType="Either" />
</handlers>
</system.webServer>
</location>

Note:Thepathattribute of thelocationelement should be the name of your site and the value of thescriptProcessorattribute should point to the cgi executable of your PHP installation.

7.Save theapplicationhost.configfile.

8.Back in WebMatrix, click onFiles, then onAdd a file to your site:

image

9.PHP will not be listed in the types of files you can add. Instead, choose an HTML file, but name it with a .php extension:

image

Now you are ready to write PHP code:

image

That’s it for now. I’ll continue to use WebMatrix and write more about what I find, but I’m hoping this will get you started with using WebMatrix and PHP so you can chime in with your feedback (which I will make sure makes it to the development team).

Thanks.

-Brian


原文地址:http://blogs.msdn.com/b/brian_swan/archive/2010/07/12/creating-php-websites-with-webmatrix.aspx

分享到:
评论

相关推荐

    使用WindowsAzure的WebSites和WebMatrix创建PHP和MySQL站点.doc

    在本文档中,我们探讨了如何使用Windows Azure的WebSites服务和WebMatrix工具来创建和管理基于PHP和MySQL的Web站点。Windows Azure Web Sites提供了一种便捷的方式,允许用户快速部署和托管Web应用,而WebMatrix则是...

    Beginning ASP.NET Web Pages with WebMatrix

    ### ASP.NET Web Pages with WebMatrix 知识点详解 #### 一、概述 《Beginning ASP.NET Web Pages with WebMatrix》是一本专为初学者编写的关于如何使用ASP.NET Web Pages和WebMatrix创建网站的书籍。本书由Mike ...

    Building ASP.NET Web Pages with Microsoft WebMatrix

    Building ASP.NET Web Pages with Microsoft WebMatrix Building ASP.NET Web Pages with Microsoft WebMatrix Building ASP.NET Web Pages with Microsoft WebMatrix

    webmatrix最新版本

    首先,WebMatrix支持多种Web技术,包括ASP.NET Web Pages、ASP.NET MVC和PHP。ASP.NET Web Pages是一种基于Razor语法的编程模型,它允许开发者以更自然的代码样式编写动态网页。Razor视图引擎则提供了简洁的语法,让...

    WebMatrix

    WebMatrix是由微软公司推出的免费轻量级Web开发工具,它为开发者提供了集成的环境来创建、测试和发布基于ASP.NET的Web应用程序。WebMatrix旨在简化Web开发过程,尤其适合初学者和小型项目,使得开发者无需深入理解...

    Wrox.Beginning.ASP.NET.Web.Pages.with.WebMatrix.2011

    《Wrox.Beginning.ASP.NET.Web.Pages.with.WebMatrix.2011》是一本专注于介绍ASP.NET Web Pages和WebMatrix的书籍,旨在帮助初学者快速掌握构建Web应用程序的基础知识。WebMatrix是由微软推出的免费集成开发环境...

    webmatrix 安装文件webmatrix 安装文件webmatrix 安装文件

    WebMatrix 是微软公司推出的一款轻量级集成开发环境(IDE),专为构建和部署Web应用程序而设计。它是一个免费的工具,特别适合初学者和小型项目开发者,集成了开发、调试和发布网站的全过程。本篇文章将深入探讨...

    BeginningASP.NetWebPagesWithWebMatrix.pdf 英文原版

    Beginning ASP.Net Web Pages With Web Matrix

    WebMatrix插件

    WebMatrix的出现旨在简化ASP.NET、PHP和HTML5的开发流程,同时支持SQL Server Compact数据库,为Web应用提供了全面的支持。 在"WebMatrix插件"这个主题下,我们可以讨论以下几个关键知识点: 1. **集成开发环境...

    Microsoft WebMatrix v2.0 简体中文版

    **Microsoft WebMatrix v2.0 简体中文版** Microsoft WebMatrix 是一款免费的集成开发环境(IDE),特别设计用于简化小型网站和Web应用程序的创建、发布和管理过程。这款工具由微软公司推出,旨在为初学者和专业...

    WebMatrix与ASP.NET MVC(源码)

    WebMatrix与ASP.NET MVC是两种不同的工具和技术,用于构建Web应用程序。它们在Web开发领域有着重要的地位,尤其对于初学者和小型项目来说,都提供了便捷的开发环境。 **WebMatrix** 是微软推出的一个轻量级集成开发...

    webmatrix2_packet

    WebMatrix2是一款由微软开发的轻量级集成开发环境(IDE),专为简化Web应用程序的创建、部署和管理而设计。这款工具集成了多种功能,包括编程、数据库管理和网站发布,使得初学者和专业开发者都能方便地进行Web开发...

    WebMatrix开发ASP_NET[汇编].pdf

    【WebMatrix 开发 ASP.NET 知识点详解】 WebMatrix 是微软推出的一款免费且轻量级的ASP.NET Web应用程序开发工具,特别适合于中小型Web应用系统的构建。它以小巧、简单、快速的特性赢得了开发者们的青睐。以下是...

    微软WebMatrix进阶教程

    - PHP集成:WebMatrix同样适用于PHP开发,提供了PHP运行环境和基本的开发工具。 - 调试与错误处理:尽管不如专业的PHP IDE强大,WebMatrix仍能显示PHP错误信息,辅助调试。 6. **网站发布** - FTP发布:...

    Microsoft WebMatrix v1.01 简体中文版

    WebMatrix 是微软公司推出的一款免费的Web 开发工具,主要用于构建、测试和发布基于ASP.NET、PHP或HTML5的Web 应用程序。这款工具集成了开发环境、数据库管理和网站发布等功能,旨在简化初学者和小型企业用户的Web ...

    Apress.Building.ASP.NET.Web.Pages.with.Microsoft.WebMatrix

    《构建ASP.NET Web Pages with Microsoft WebMatrix》这本书深入介绍了如何使用Microsoft WebMatrix工具来创建和管理ASP.NET Web Pages网站。WebMatrix是微软推出的一款轻量级集成开发环境(IDE),特别适合初学者和...

    使用微软WebMatrix进行Web开发

    【使用微软WebMatrix进行Web开发】是微软推出的一款免费的Web开发工具,旨在简化网站创建、定制和发布的流程。WebMatrix包含了一系列的功能,如Web服务器、数据库和框架,为开发者提供了一个集成的环境,适用于初学...

    WebMatrix中的文件操作(源码)

    WebMatrix是一款轻量级的开发工具,由微软公司推出,主要针对ASP.NET Web Pages和Razor语法进行网页开发。在WebMatrix中进行文件操作是开发者日常工作中常见的任务,包括读取、写入、创建、删除和移动文件等。本文将...

Global site tag (gtag.js) - Google Analytics