您现在的位置是:网站首页 > 心得笔记
wamp环境下升级PHP版本
简介此处演示的是wamp环境下将PHP7.0.0升级到PHP7.3.8
1、停止WAMP服务器
2、下载你需要安装的PHP版本。下载Window版本的ZIP包,下载地址:https://windows.php.net/download/
此处由于我本地电脑是64位的,所以选择上面那个下载包
下载完成后解压到 Wamp的安装目录\bin\php\php7.3.8
3、从已存在的php版本文件中(此处是php7.0.0 (eg. wamp/bin/php/php7.0.0)复制以下文件: - php.ini、phpForApache.ini和wampserver.conf到php7.3.8文件夹
4、打开php7.3.8文件夹的以下文件: php.ini、phpForApache.ini并且把其中所有的 7.0.0 替换为7.3.8
5、修改Wamp配置文件:进入 Wamp的安装目录(wamp/wampmanager.ini),找到[phpVersion],复制下面一行:
Type: item; Caption: "7.0.0"; Action: multi; Actions:switchPhp7.0.0; Glyph: 13
复制好后,将7.0.0改为7.3.8
修改后如下:
[phpVersion] ;WAMPPHPVERSIONSTART Type: item; Caption: "5.6.16"; Action: multi; Actions:switchPhp5.6.16 Type: item; Caption: "7.0.0"; Action: multi; Actions:switchPhp7.0.0; Glyph: 13 Type: item; Caption: "7.3.8"; Action: multi; Actions:switchPhp7.3.8;
同理,复制[switchPhp7.0.0]
Action: service; Service: wampapache64; ServiceAction: stop; Flags: ignoreerrors waituntilterminated Action: run; FileName: "E:/wamp64/bin/php/php5.6.16/php-win.exe";Parameters: "switchPhpVersion.php 7.0.0";WorkingDir: "E:/wamp64/scripts"; Flags: waituntilterminated Action: run; FileName: "E:/wamp64/bin/php/php5.6.16/php.exe";Parameters: "-c . switchMysqlPort.php 3306";WorkingDir: "E:/wamp64/scripts"; Flags: waituntilterminated Action: run; FileName: "E:/wamp64/bin/php/php5.6.16/php-win.exe";Parameters: "refresh.php";WorkingDir: "E:/wamp64/scripts"; Flags: waituntilterminated Action: run; FileName: "net"; Parameters: "start wampapache64"; ShowCmd: hidden; Flags: waituntilterminated Action: resetservices Action: readconfig;
复制好后,将7.0.0改为7.3.8
修改后如下:
[switchPhp5.6.16] Action: service; Service: wampapache64; ServiceAction: stop; Flags: ignoreerrors waituntilterminated Action: run; FileName: "E:/wamp64/bin/php/php5.6.16/php-win.exe";Parameters: "switchPhpVersion.php 5.6.16";WorkingDir: "E:/wamp64/scripts"; Flags: waituntilterminated Action: run; FileName: "E:/wamp64/bin/php/php5.6.16/php.exe";Parameters: "-c . switchMysqlPort.php 3306";WorkingDir: "E:/wamp64/scripts"; Flags: waituntilterminated Action: run; FileName: "E:/wamp64/bin/php/php5.6.16/php-win.exe";Parameters: "refresh.php";WorkingDir: "E:/wamp64/scripts"; Flags: waituntilterminated Action: run; FileName: "net"; Parameters: "start wampapache64"; ShowCmd: hidden; Flags: waituntilterminated Action: resetservices Action: readconfig; [switchPhp7.0.0] Action: service; Service: wampapache64; ServiceAction: stop; Flags: ignoreerrors waituntilterminated Action: run; FileName: "E:/wamp64/bin/php/php5.6.16/php-win.exe";Parameters: "switchPhpVersion.php 7.0.0";WorkingDir: "E:/wamp64/scripts"; Flags: waituntilterminated Action: run; FileName: "E:/wamp64/bin/php/php5.6.16/php.exe";Parameters: "-c . switchMysqlPort.php 3306";WorkingDir: "E:/wamp64/scripts"; Flags: waituntilterminated Action: run; FileName: "E:/wamp64/bin/php/php5.6.16/php-win.exe";Parameters: "refresh.php";WorkingDir: "E:/wamp64/scripts"; Flags: waituntilterminated Action: run; FileName: "net"; Parameters: "start wampapache64"; ShowCmd: hidden; Flags: waituntilterminated Action: resetservices Action: readconfig; [switchPhp7.3.8] Action: service; Service: wampapache64; ServiceAction: stop; Flags: ignoreerrors waituntilterminated Action: run; FileName: "E:/wamp64/bin/php/php5.6.16/php-win.exe";Parameters: "switchPhpVersion.php 7.3.8";WorkingDir: "E:/wamp64/scripts"; Flags: waituntilterminated Action: run; FileName: "E:/wamp64/bin/php/php5.6.16/php.exe";Parameters: "-c . switchMysqlPort.php 3306";WorkingDir: "E:/wamp64/scripts"; Flags: waituntilterminated Action: run; FileName: "E:/wamp64/bin/php/php5.6.16/php-win.exe";Parameters: "refresh.php";WorkingDir: "E:/wamp64/scripts"; Flags: waituntilterminated Action: run; FileName: "net"; Parameters: "start wampapache64"; ShowCmd: hidden; Flags: waituntilterminated Action: resetservices Action: readconfig;
6、去wamp/bin/apache/apache/apache2.4.17/bin删除php.ini文件
7、重启wamp
8、选择php7.3.8版本,选择后后会重启wamp。
9、可以打开phpinfo察看此时是否有php7.3.8的信息,然后打开Phpmyadmin,看是否可以访问。
~END~