手動方式 WAMPServer 更新 Apache 版本

情況是要把 WampServer 3.2.0 裏頭的 Apache 2.4.43 升級到 2.4.48。
理論上要先把 WampServer 先升級到 3.2.3 再到 3.2.5 (apache 2.4.48要求),然後才能安裝 Apache 2.4.48。

在 WampServer 3.2.5 更新其實只有改動 wampmanager, 其他各個元件都沒有更動。

wampserver update 3.2.5

但實際上 WampServer 3.2.3 其實沒甚麼很 critical 的更新,只是單純將各個元件包新版本進去,且因為系統需要跑在 php 7.3.x 以下(Well, 之後要被迫升級 php 版本的話又要痛一次)。基於人性,就想能夠不要安裝 WampServer 3.2.3 就盡可能偷懶。

偷懶的方式是這樣,先更新 VC++ 2015-2019 distributor 到 v14.29.30037, 然後安裝 wampserver 3.2.5 ,然後再下載 Apache 2.4.48並安裝。上面這幾個下載都可以在 https://wampserver.aviatechno.net/找到。

安裝後會發現在 wampserver 的選單中不會出現 apache 2.4.48 的選項,這時候就是需要手動修改的部分。

先將所有 wampserver 所管理的 service 停止,並關閉 wampserver,開始手動編輯原本的 wampmanager.ini (以我這邊的路徑是在 C:\wamp64_3.2.0\wampmanager.ini)。檔案很長,但重點在 apacheVersion 這個區段

[apacheVersion]
;WAMPAPACHEVERSIONSTART
Type: item; Caption: "2.4.41"; Action: multi; Actions:switchApache2.4.41
Type: item; Caption: "2.4.43"; Action: multi; Actions:switchApache2.4.43
Type: item; Caption: "2.4.48"; Action: multi; Actions:switchApache2.4.48; Glyph: 13

[switchApache2.4.41]
; skip lines

[switchApache2.4.43]
; skip lines

[switchApache2.4.48]
Action: service; Service: wampapache64; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
Action: run; Filename: "sc"; Parameters: "\\. stop wampapache64"; ShowCmd: hidden; Flags: waituntilterminated
Action: run; Filename: "sc"; Parameters: "\\. delete wampapache64"; ShowCmd: hidden; Flags: waituntilterminated
Action: closeservices; Flags: ignoreerrors
Action: run; Filename: "taskkill"; Parameters: "/FI ""IMAGENAME eq httpd.exe"" /T /F"; ShowCmd: hidden; Flags: waituntilterminated
Action: run; FileName: "c:/wamp64_3.2.0/bin/php/php5.6.40/php.exe";Parameters: "switchApacheVersion.php 2.4.48";WorkingDir: "c:/wamp64_3.2.0/scripts"; Flags: waituntilterminated
Action: run; FileName: "c:/wamp64_3.2.0/bin/php/php5.6.40/php-win.exe";Parameters: "switchPhpVersion.php 7.3.12";WorkingDir: "c:/wamp64_3.2.0/scripts"; Flags: waituntilterminated
Action: run; FileName: "c:/wamp64_3.2.0/bin/apache/apache2.4.48/bin/httpd.exe"; Parameters: "-n wampapache64 -k install"; ShowCmd: hidden; Flags: waituntilterminated
Action: run; Filename: "sc"; Parameters: "\\. config wampapache64 start= demand"; ShowCmd: hidden; Flags: waituntilterminated
Action: run; FileName: "c:/wamp64_3.2.0/bin/php/php5.6.40/php.exe";Parameters: "switchWampPort.php 80 notvhost";WorkingDir: "c:/wamp64_3.2.0/scripts"; Flags: waituntilterminated
Action: run; FileName: "net"; Parameters: "start wampapache64"; ShowCmd: hidden; Flags: waituntilterminated
Action: run; FileName: "c:/wamp64_3.2.0/bin/php/php5.6.40/php-win.exe";Parameters: "refresh.php";WorkingDir: "c:/wamp64_3.2.0/scripts"; Flags: waituntilterminated
Action: resetservices
Action: readconfig
;WAMPAPACHEVERSIONEND

把原本 2.4.43 的複製一份,改成 2.4.48, 並將原本選單設定多加上 2.4.48 的選項,並將預設勾選(; Glyph: 13),從 2.4.43 改過去 2.4.48 (上面 line 4~5)。

然後把文件中搜尋 2.4.43 該換成 2.4.48 的改一改,然後再重新啟動 wampserver 就可以了(重啟時會問要不要把原本 2.4.43 的 config 複製到 2.4.48,就請自己決定吧)。