Wampserver如何安裝舊版本php


Posted by iversonlin330 on 2020-11-05

前言

今天要來說明如何在wampserver安裝舊版本php
為什麼會有這個需求呢?
在前些日子接到了一個php維護案
想說先在Local環境架設吧
沒想到出現一堆Error
挖哩勒怎麼還在用mysql_connect
這個function在php5.5就被遺棄了
後來一查才發現原來這個網站只跑在php 5.3阿...
轉頭再看看自己的wampserver版本
恩...最低只有支援到5.6
於是乎開始上網尋找各種solution
下方進入正題開始教學

教學開始

下載wampserver php套件

首先進入以下網站
https://wampserver.aviatechno.net/
找到我們要下載的區塊(如果你要安裝的版本跟我一樣舊,記得打開See all available versions)

發現有32bit跟64bit要下載哪個呢
這時候就要看你的wampserver版本

查看Wampserver版本

打開你的wampserver安裝資料夾
找到wampmanager.ini檔案
裡面應該有類似以下字串
WampServer Version 3.2.0 64bit

安裝後設定

安裝後重新啟動wampserver
運氣好的你會發現在php list中會多一個剛剛安裝的版本
如果運氣不好沒有出現請繼續往下設定
我是安裝5.3.28所以我用這個版本來做示範,如果你是安裝其他版本記得把參數調整一下
這時候請打開wampmanager.ini

  1. 找到[phpVersion] 並在下方加入以下字串
    Type: item; Caption: "5.3.28"; Action: multi; Actions:switchPhp5.3.28
    
  2. 你可以找到下方有[switchPhp xxxx]
    複製他並貼上,如下
    [switchPhp5.3.28]
    Action: service; Service: wampapache64; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
    Action: run; FileName: "c:/wamp64/bin/php/php5.3.28/php-win.exe";Parameters: "switchPhpVersion.php 5.3.28";WorkingDir: "c:/wamp64/scripts"; Flags: waituntilterminated
    Action: run; FileName: "c:/wamp64/bin/php/php5.3.28/php.exe";Parameters: "switchMysqlPort.php 3308";WorkingDir: "c:/wamp64/scripts"; Flags: waituntilterminated
    Action: run; FileName: "c:/wamp64/bin/php/php5.3.28/php-win.exe";Parameters: "refresh.php";WorkingDir: "c:/wamp64/scripts"; Flags: waituntilterminated
    Action: run; FileName: "net"; Parameters: "start wampapache64"; ShowCmd: hidden; Flags: waituntilterminated
    Action: resetservices
    Action: readconfig
    
    都設定完之後重新啟動應該就會發現你的php version list中多了新的版本吧
    希望大家都能順利成功安裝

#wampserver #PHP #tool







Related Posts

Day00 那些年我所不知道的 Web API 們

Day00 那些年我所不知道的 Web API 們

跑來跑去卻也有進度的一天

跑來跑去卻也有進度的一天

待補

待補


Comments