一、下载phpstudy2018
1、下载地址:https://www.xp.cn/wenda/406.html ,按步骤安装即可(不需要更新)
2、点击“切换版本”
二、iis7 安装CGI模块(作用:使iis能够解析php脚本) 重启iis : win +R 输入命令:iisreset
三、安装 URL rewrite模块
地址:https://www.iis.net/downloads/microsoft/url-rewrite#additionalDownloads , 选择 en-x64 -- 重启iis
以上两个配置安装好后
查看绑定的端口
四、把项目文件放到 phpstudy安装 目录的www 目录下 ,在iis上 创建网站 ->基本设置->物理路径指向www目录的 public/ (也就是index.php入口文件这里,其他不变)
五、在public 目录创建web.config 文件,把一下内容粘贴到文件中
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="OrgPage" stopProcessing="true"> <match url="^(.*)$" /> <conditions logicalGrouping="MatchAll"> <add input="{HTTP_HOST}" pattern="^(.*)$" /> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php/{R:1}" /> </rule> </rules> </rewrite> <directoryBrowse enabled="false" /> <security> <requestFiltering allowDoubleEscaping="True" /> </security> <defaultDocument> <files> <clear /> <add value="index.php" /> <add value="Default.htm" /> <add value="Default.asp" /> <add value="index.htm" /> <add value="index.html" /> <add value="iisstart.htm" /> </files> </defaultDocument> </system.webServer> </configuration>
五、给项目文件夹 runtime 设置用户组全部权限
六、启动phpstudy的MySQL,将数据库文件导入到mysql,修改数据库配置文件
推荐:https://www.cnblogs.com/xuzhengzong/articles/10145096.html