您好,欢迎访问一九零五行业门户网

PHP在II7安装指南

参考文档:
using fastcgi to host php applications on iis 7.0
一、php的安装
1、下载并安装程序
php 5.2.8 non-thread-safe zip package
the update for fastcgi module
administration pack for iis 7.0
win2008下的iis7与php相关问题
2、配置php.ini
把c:\php\php.ini-recommended 复制成php.ini,然后修改文件:
fastcgi.impersonate = 1
cgi.fix_pathinfo=1
cgi.force_redirect = 0
open_basedir =g:\projects_php   
extension_dir = c:\php\ext ;extension_dir = ./
extension=php_mssql.dll
extension=php_mysql.dll
extension=php_gd2.dll
extension=php_mbstring.dll
extension=php_mcrypt.dll
extension=php_pdo.dll
extension=php_pdo_mysql.dll
extension=php_pdo_mysql.dll
其中open_basedir表示网站所在的包含目录,你也可以指定为g:\,这样只要在g盘下的网站都可以在安全范围之内
#为了使用session需要添加设置 session.save_path = c:\php\tmp 并创建目录tmp
#extension_dir = c:\php\ext
3、配置iis
iis根-->handler mappings-->
    request path: *.php
    module: fastcgimodule
    executable: c:\php\php-cgi.exe
    name: php via fastcgi
iis根-->fastcgi settings-->edit... --> edit fastcgi application-->instancemaxrequest=10000
--> environmentvariables --> php_fcgi_max_requests=10000
4、推荐的安全配置(仅供参考)
    allow_url_fopen=off
    allow_url_include=off
    register_globals=off
    open_basedir=c:inetpub
    safe_mode=off
    safe_mode_gid=off
    max_execution_time=30
    max_input_time=60
    memory_limit=16m
    upload_max_filesize=2m
    post_max_size=8m
    max_input_nesting_levels=64
    display_errors=off
    log_errors=on
    error_log=c:pathofyourchoice
    fastcgi.logging=0
    expose_php=off
5、独立配置
参考:http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-70/
中的per-site php process pools和specifying php.ini location
a、iis根-->fastcgi settings-->add appliction....-->fullpath=c:\php\php-cgi.exe
                                                                           arguments=-d open_basedir=g:\projects_php\samples\php_hello2
查看:c:\windows\system32\inetsrv\config\applicationhost.config可见有如下配置:
environmentvariables >
  application >
  arguments =-d open_basedir=g:\projects_php\samples\php_hello2  maxinstances =4  idletimeout =300  activitytimeout =30  requesttimeout =90
instancemaxrequests=200 protocol=namedpipe queuelength=1000 flushnamedpipe=false
rapidfailsperminute=10 />
b、修改网站的web.config
xml version=1.0 ?>
handlers >
system.webserver >
configuration >
6、配置环境变量
例如安装目录在c:\php
配置path的变量添加c:\php\;
7、安装url rewrite module
下载rewrite_x86_rtw.msi 
参考:url rewrite module using url rewrite module url rewrite module configuration reference
其它类似信息

推荐信息