iis-7.5 - 如何在 IIS7.5 Express 上运行 PHP?

标签 iis-7.5 iis-express mysql5 php-5.2 windows-xp-sp3

我有 Win XP SP3 并安装了 IIS7.5 Express 并希望在其上运行 PHP。

我能够在服务器上运行简单的 HTML 代码,我能够通过运行 iisservices.exe 来启动和停止服务器,但我无法在其上运行 php 脚本。

如果我有以下 PHP 文件:

<? php 
echo "hello world";
?>
<html>HI</html>

输出为 HI但 PHP 脚本不运行。

我已按照本文中描述的步骤安装 PHP:

http://learn.iis.net/page.aspx/724/install-and-configure-php/



但不能从第 10 步开始,因为 IIS Express 没有 IIS 管理控制台 MMC 管理单元。

如何配置 IIS Express 以运行 PHP?

最佳答案

假设您已经在 the article you linked to 中执行了步骤 1 - 9并将您的 PHP 文件提取到 c:\php然后使用 cmd.exe 完成以下步骤命令提示符:

首先,我们需要配置 IIS Express 并为 PHP 设置处理程序

cd "\Program Files\IIS Express"

appcmd 设置配置 -section:system.webServer/fastCgi/+"[fullPath='C:\PHP\php-cgi.exe',arguments='',maxInstances='4',idleTimeout='300',activityTimeout=' 30',requestTimeout='90',queueLength='1000',instanceMaxRequests='200',protocol='NamedPipe',flushNamedPipe='False',rapidFailsPerMinute='10']"/commit:apphost

appcmd 设置配置 -section:system.webServer/handlers/+"[name='PHP-FastCGI',path='*.php',modules='FastCgiModule',verb='*', scriptProcessor='c:\php\php-cgi.exe']"/commit:apphost

假设您的 PHP 网站位于 c:\MyPHPWeb我们在 IIS Express 中创建一个站点来监听 http://localhost:32701 :

appcmd 添加站点/name:"MyPHPApp"/bindings:http/*:32701:/physicalPath:"c:\MyPHPWeb"

接下来启动站点:

iisexpress.exe/site:MyPHPApp

最后浏览到您的 PHP 页面:

http://localhost:32701/test.php

关于iis-7.5 - 如何在 IIS7.5 Express 上运行 PHP?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7080374/

相关文章:

c# - 系统.安全.SecurityException : Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib' failed

asp.net - 当应用程序的其余部分在 Windows 身份验证下运行时,允许匿名到 ASP.NET Web API Controller

visual-studio-2015 - ScriptedSandbox64.exe 已停止工作

Mysql时间格式自动%H :%i:%s

asp.net - windows身份验证不断提示ie的用户名密码

IIS7.5 OutputCacheModule 内核缓存 'public' 忽略 URL

visual-studio-2013 - 为什么以及如何解决? IIS Express "The specified port is in use"

c# - IIS Express 不通过基本身份验证提供静态文件

php - 实时接收 php 中的 mysql 更新

mysql - 如何导入数据库,更新已更改的产品,删除已删除的产品