【Azure Services Platform Step by Step-第13篇】在Windows Azure中使用PHP
新建Web Cloud Service项目。第五步配置Service Definition 文件(ServiceDefinition.csdef)。?xml version1.0 encodingutf-8?ServiceDefinition nameCloudService1 xmlnshttp://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinitionWebRole nameWebRoleenableNativeCodeExecutiontrueInputEndpointsInputEndpoint nameHttpIn protocolhttp port80 //InputEndpoints/WebRole/ServiceDefinition注意需要在WebRole节点下增加enableNativeCodeExecutiontrue属性第六步配置FastCGI和PHP将刚刚下载的xcopy-deployable PHP压缩包解压缩到WebRole项目的php子目录下。在WebRole项目根目录下增加Web.roleconfig文件内容如下?xml version1.0 encodingutf-8 ?configurationsystem.webServerfastCgiapplication fullPath%RoleRoot%\php\php-cgi.exe //fastCgi/system.webServer/configuration这里我们使用了%RoleRoot%变量来获得Web Role的根目录。这也是Match 2009 CTP版本所提供的新特性之一。在Web.config文件的system.webServer-handlers节下增加对PHP文件的处理system.webServerhandlers..add namePHP via FastCGI path*.php verb* modulesFastCgiModulescriptProcessor%RoleRoot%\php\php-cgi.exeresourceTypeUnspecified //handlers/system.webServer第七步写一些简单的代码测试一下吧代码?php$iipp$_SERVER[REMOTE_ADDR];echo 你的IP地址是.$iipp.br /;echo 这是用PHP的echo命令输出的文字。br /;echo h1font colorRedbHello PHP on Azure!/b/font/h1br /;echo a hrefhttp://azure.cnblogs.com/流牛木马的Azure博客/abr /;echo font colorBlue以下是当前PHP环境的系统变量/fontbr /;phpinfo();?效果图