<li id="jut4n"></li>
  • 系統城裝機大師 - 唯一官網:www.ship-models.net!

    當前位置:首頁 > server > anz > 詳細頁面

    系統城教小白windows server 2019開啟iis服務器+tp5.1的完美配置運行流程圖解

    時間:2022-03-02來源:www.ship-models.net作者:電腦系統城

    目錄
    • 一、新建IIS服務器
    • 二、IIS服務器配置
    • 三、下載php,并配置
    • 四、IISurlrewrite錯誤
    • 五、tp5的配置

    一、新建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如下所示:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    zlib.output_compression = On //啟用Gzip壓縮
    max_execution_time = 30 //最大執行時間,按需改
    memory_limit = 128M //內存大小限制
    display_errors = Off //關閉報錯
    error_log = e:\temp\php_errors.log
    post_max_size = 100M //最大POST大小,按需改
    extension_dir = "e:\PHP\ext" //ext文件夾位置
    cgi.force_redirect = 0
    cgi.fix_pathinfo=1
    fastcgi.impersonate = 1
    fastcgi.logging = 0
    upload_tmp_dir = e:\temp
    upload_max_filesize = 100M //最大上傳大小,按需改
    date.timezone = Asia/shanghai //時區
    session.save_path = "e:\temp"
    session.auto_start = 0
    sys_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,并填寫如下內容。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    <?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可以完美運行到服務器上。

    分享到:

    相關信息

    系統教程欄目

    欄目熱門教程

    人氣教程排行

    站長推薦

    熱門系統下載

    淑芬两腿间又痒了