Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
741 views
in Technique[技术] by (71.8m points)

iis 7.5 - How to Run PHP on IIS7.5 Express?

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

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.

If I have the following PHP file:

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

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

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

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

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

How do I configure IIS Express to run PHP?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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:

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

cd "Program FilesIIS Express"

appcmd set config -section:system.webServer/fastCgi /+"[fullPath='C:PHPphp-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:phpphp-cgi.exe']" /commit:apphost

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"

Next start the site:

iisexpress.exe /site:MyPHPApp

And finally browse to your PHP page:

http://localhost:32701/test.php

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...