如何在IIS7.5 Express上运行PHP? [英] How to Run PHP on IIS7.5 Express?

查看:255
本文介绍了如何在IIS7.5 Express上运行PHP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have Win XP SP3 and have installed IIS7.5 Express and want to run PHP on it.

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

I am able to run simple HTML code on the server, I am able to start and stop the server by running iisservices.exe, but I am not able to run php scripts on it.

如果我有以下PHP文件:

If I have the following PHP file:

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

输出为HI,但PHP脚本未运行.

The output is HI but the PHP script doesn't run.

我已按照本文中介绍的步骤安装PHP:

I have followed the steps described in this article to install PHP:

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

但是不能从步骤10开始进行,因为IIS Express没有IIS管理控制台MMC管理单元.

But can't proceed from step 10 onwards because IIS Express doesn't have an IIS Management Console MMC snap-in.

如何配置IIS Express以运行PHP?

How do I configure IIS Express to run PHP?

推荐答案

假定您已执行

Assuming you've carried out steps 1 - 9 in the article you linked to and have your PHP files extracted to c:\php then complete the following steps using a cmd.exe command prompt:

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

Firstly we need to configure IIS Express and setup a handler for PHP


cd "\Program Files\IIS Express"

appcmd set config -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 set config -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的网站:

Assuming your PHP website resides in c:\MyPHPWeb we create a site in IIS Express that listens on http://localhost:32701:


appcmd add site /name:"MyPHPApp" /bindings:http/*:32701: /physicalPath:"c:\MyPHPWeb"

下一步启动站点:


iisexpress.exe /site:MyPHPApp

最后浏览到您的PHP页面:

And finally browse to your PHP page:


http://localhost:32701/test.php

这篇关于如何在IIS7.5 Express上运行PHP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆