【文章版权归作者和CNBLOG所有,转载请务必注明原始出处】

猫尾巴的狐狸

导航

Windows azure 上运行PHP

Windows azure 发布好一段时间了,Fast CGI 的支持,使得Php也可以跑在上面。

[更多信息可以访问 http://phpazure.com/]

通过以下几步简单的配置,您的php就可以发布到云端了。

1. ServiceDefinition.csdef

<ServiceDefinition name="CloudPhp" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
  <WebRole name="WebCgiRole1" enableNativeCodeExecution="true">
    <InputEndpoints>
      <InputEndpoint name="HttpIn" protocol="http" port="80" />
    </InputEndpoints>
    <ConfigurationSettings>
      <Setting name="DiagnosticsConnectionString" />
    </ConfigurationSettings>
  </WebRole>
</ServiceDefinition>

2. Web.config

在 system.webServer  的 handlers 节点中添加如下代码

<add name="PHP-FastCGI"  path="*.php"  verb="*"  modules="FastCgiModule"
              scriptProcessor="%RoleRoot%\approot\php\php-cgi.exe"
              resourceType="Unspecified" />

[假定您的php相关文件放在了项目跟目录/php中]

3. Web.roleconfig

<configuration>
  <system.webServer>
    <fastCgi>
      <application fullPath="%RoleRoot%\approot\php\php-cgi.exe" />
    </fastCgi>
  </system.webServer>

</configuration>

4. 当然 您的php相关文件 得作为content 放到项目里面,一起发布。

image

a5

posted on 2010-05-03 10:04  GinoHuo  阅读(297)  评论(0编辑  收藏  举报