一、下載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