我使用的操作系统是windows7 sp1 64位
第一,首先在Windows系统上安装IIS,在控制面板 -> 程序 -> 打开或关闭 Windows 功能,如图:
然后选择 Internet 信息服务并且安装里面的Web 管理工具和万维网服务,如图:
第二,打开IIS。打开 开始 -> 在搜索框里面输入 IIS 进行搜索 -> 点击打开 Internet 信息服务(IIS)管理器,如图
IIS环境配置
设置启用 32 位应用程序(使用asp的*.mdb数据库查询的时候不会报错)
第三,新建php网站并进行相关配置。为了可以使用伪静态功能,需要额外安装 重写模块(URL Rewrite,下载官网为:https://www.iis.net/downloads/microsoft/url-rewrite,我的文件下载链接为:https://download.microsoft.com/download/1/2/8/128E2E22-C1B9-44A4-BE2A-5859ED1D4592/rewrite_amd64_zh-TW.msi)。
配置IIS可以使用PHP,新建好一个网站后,然后点击那个新建好的网站,然后再点击 处理程序映射,然后在点击 添加模块映射,如图:
伪静态配置,在网站根目录下编辑配置文件 web.config 内容为
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpRedirect enabled="false" />
<handlers>
<add name="php56" path="*.php" verb="GET,HEAD,POST,DEBUG" modules="FastCgiModule" scriptProcessor="c:\php56\php-cgi.exe" />
</handlers>
<rewrite>
<rules>
<rule name="已导入的规则 5" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> </conditions>
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>