php × IIS (WITHOUT XAMPP)

php 官方文件

MySQL & phpMyAdmin

整理筆記

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
整理中…

  1. 到此處下載 Windows 版 php 的 Non Thread Safe(NTS) 版本

    Which version do I choose?
    IIS
    If you are using PHP as FastCGI with IIS you should use the Non-Thread Safe (NTS) versions of PHP.

  2. Win+R 執行: OptionalFeatures 勾選這些功能
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  3. 以系統管理員身分執行以下 bat 檔案或複製貼上到 CMD 執行。
    ⚠️請將 phppath=%systemdrive%\inetpub\php 改為你解壓縮前面下載的 Zip 壓縮檔後存放的資料夾
    ​​​​@echo off ​​​​REM CODE COPY FORM https://www.php.net/manual/zh/install.windows.manual.php ​​​​REM download .ZIP file of PHP build from http://windows.php.net/downloads/ ​​​​REM path to directory you decompressed PHP .ZIP file into (no trailing \) ​​​​set phppath=%systemdrive%\inetpub\php ​​​​REM Clear current PHP handlers ​​​​%windir%\system32\inetsrv\appcmd.exe clear config /section:system.webServer/fastCGI ​​​​REM The following command will generate an error message if PHP is not installed. This can be ignored. ​​​​%windir%\system32\inetsrv\appcmd.exe set config /section:system.webServer/handlers /-[name='PHP_via_FastCGI'] ​​​​REM Set up the PHP handler ​​​​%windir%\system32\inetsrv\appcmd.exe set config /section:system.webServer/fastCGI /+[fullPath='%phppath%\php-cgi.exe'] ​​​​%windir%\system32\inetsrv\appcmd.exe set config /section:system.webServer/handlers /+[name='PHP_via_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='%phppath%\php-cgi.exe',resourceType='Unspecified'] ​​​​%windir%\system32\inetsrv\appcmd.exe set config /section:system.webServer/handlers /accessPolicy:Read,Script ​​​​REM Configure FastCGI Variables ​​​​%windir%\system32\inetsrv\appcmd.exe set config /section:system.webServer/fastCgi /[fullPath='%phppath%\php-cgi.exe'].instanceMaxRequests:10000 ​​​​%windir%\system32\inetsrv\appcmd.exe set config /section:system.webServer/fastCgi /+"[fullPath='%phppath%\php-cgi.exe'].environmentVariables.[name='PHP_FCGI_MAX_REQUESTS',value='10000']" ​​​​%windir%\system32\inetsrv\appcmd.exe set config /section:system.webServer/fastCgi /+"[fullPath='%phppath%\php-cgi.exe'].environmentVariables.[name='PHPRC',value='%phppath%\php.ini']" ​​​​REM [Optional] Add Default Document File ​​​​REM https://learn.microsoft.com/iis/configuration/system.webserver/defaultdocument/files/add ​​​​%windir%\system32\inetsrv\appcmd.exe set config /section:defaultDocument /enabled:true /+files.[value='index.php'] ​​​​ ​​​​REM [Optional] Disable autostart IIS after starting windows ​​​​REM https://learn.microsoft.com/windows-server/administration/windows-commands/sc-config ​​​​%windir%\system32\sc.exe config W3SVC start= demand ​​​​pause
  4. php 檔案丟到 %systemdrive%\inetpub\wwwroot 就完成建置了
Select a repo