一、新建IIS服务器
然后一直点击下一步,直到下图所示: 
选择上如下图所选: 
然后下一步安装上即可。
二、IIS服务器配置新建网站如下图所示: 
点击基本设置,按要求填写即可: 
双击处理映射程序 
弹出如下图所示: 
点击添加模块映射,填写如下图所示: 
接下来: 
双击默认文档,添加index.php: 
三、下载php,并配置链接:https://windows.php.net/downloads/releases/php-7.3.17-nts-Win32-VC15-x64.zip,注意php-7.4对tp5.1支持有问题,所以最好用php7.3 
把上面的复制一份,修改为php.ini 修改php.ini如下所示: zlib.output_compression = On //启用Gzip压缩max_execution_time = 30 //最大执行时间,按需改memory_limit = 128M //内存大小限制display_errors = Off //关闭报错error_log = e:/temp/php_errors.logpost_max_size = 100M //最大POST大小,按需改extension_dir = "e:/PHP/ext" //ext文件夹位置cgi.force_redirect = 0cgi.fix_pathinfo=1fastcgi.impersonate = 1fastcgi.logging = 0upload_tmp_dir = e:/tempupload_max_filesize = 100M //最大上传大小,按需改date.timezone = Asia/shanghai //时区session.save_path = "e:/temp"session.auto_start = 0sys_temp_dir = "e:/web/temp/tmp" 开启扩展: extension=xxxxx //去掉前面的分号以启用对应扩展
我打开了这些:curl、fileinfo、gd2、gettext、mbstring、exif、mysqli、openssl、pdo_mysql、xmlrpc
四、IIS url rewrite错误win+R 输入 regedit 在HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/InetStp位置 修改注册表 把MajorVersion的值改为9 下载:https://www.iis.net/downloads/microsoft/url-rewrite 并安装即可。
五、tp5的配置在public文件夹下添加web.config,并填写如下内容。 <?xml version="1.0" encoding="UTF-8"?><configuration> <system.webServer> <rewrite> <rules> <rule name="已导入的规则 1" 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> <defaultDocument> <files> <add value="index.php" /> </files> </defaultDocument> </system.webServer></configuration> 如果:tp5报错:Non-string needles will be interpreted as strings in the future 修改错误:./extend/XBase/Column.php $this->name = (strpos($name, 0x00) !== false ) ? substr($name, 0, strpos($name, 0x00)) : $name;改为: $this->name = (strpos($name, chr(0x00)) !== false ) ? substr($name, 0, strpos($name, chr(0x00))) : $name;
整个流程走下来,tp5可以完美运行到服务器上。 下载地址: windows Docker Portainer 可视化面板的使用 |