实现wamp中PHP/Apache/Mysql版本切换(定制php版本)
由于这一段常常需要在不同的PHP版本之间进行切换,我用的是wamp,所以就总结一下wamp下实现不同的php、apache、mysql版本的切换:首先安装不同版本的wamp,如果你和我一样出现不能正常切换版本,按照以下步骤配置wamp安装目录下的wampmanager.ini即可
1、配置wamp的版本选择菜单
找到第320行有一个标签,type:item那一行是添加wamp选择菜单的,如果想添加其他版本的,复制一行添加到Type: separator;上面即可,php和
mysql的版本选择菜单也是这样添加的,比葫芦画瓢即可。
;WAMPAPACHEVERSIONSTART
Type: item; Caption: "2.2.21"; Action: multi; Actions:switchApache2.2.21; Glyph: 13
Type: item; Caption: "2.4.4"; Action: multi; Actions:switchApache2.4.4
Type: separator;
Type: item; Caption: "Get more..."; Action: run; FileName: "C:\Windows\explorer.exe"; Parameters: "http://www.wampserver.com/addons_apache.php";
2、配置版本切换
配置好菜单按钮之后,找到的标签,其他版本标签下内容照着下面的模板改一下保存,就可以切换了
Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
Action: run; FileName: "D:/Program Files/wamp/bin/apache/apache2.2.21/bin/httpd.exe"; Parameters: "-n wampapache -k uninstall"; ShowCmd: hidden; Flags: ignoreerrors waituntilterminated
Action: closeservices; Flags: ignoreerrors
Action: run; FileName: "D:/Program Files/wamp/bin/apache/apache2.2.21/bin/httpd.exe"; Parameters: "-n wampapache -k install"; ShowCmd: hidden; Flags: waituntilterminated
Action: run; FileName: "net"; Parameters: "start wampapache"; ShowCmd: hidden; Flags: waituntilterminated
Action: resetservices
Action: readconfig;
php的切换照着修改为自己的版本即可
Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
Action: run; FileName: "D:/Program Files/wamp/bin/php/php5.3.10/php-win.exe";Parameters: "switchPhpVersion.php 5.3.10";WorkingDir: "D:/Program Files/wamp/scripts"; Flags: waituntilterminated
Action: run; FileName: "D:/Program Files/wamp/bin/php/php5.3.10/php-win.exe";Parameters: "-c . refresh.php";WorkingDir: "D:/Program Files/wamp/scripts"; Flags: waituntilterminated
Action: run; FileName: "net"; Parameters: "start wampapache"; ShowCmd: hidden; Flags: waituntilterminated
Action: resetservices
Action: readconfig;
mysql参照修改为自己的:
Action: service; Service: wampmysqld; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
Action: run; FileName: "D:/Program Files/wamp/bin/mysql/mysql5.5.20/bin/mysqld.exe"; Parameters: "--remove wampmysqld"; ShowCmd: hidden; Flags: ignoreerrors waituntilterminated
Action: closeservices;
Action: run; FileName: "D:/Program Files/wamp/bin/mysql/mysql5.5.20/bin/mysqld.exe"; Parameters: "--install-manual wampmysqld"; ShowCmd: hidden; Flags: waituntilterminated
Action: run; FileName: "net"; Parameters: "start wampmysqld"; ShowCmd: hidden; Flags: waituntilterminated
Action: resetservices;
Action: readconfig;
3、自己定制php、apache、mysql版本
(1)到windows.php.net 下载相应版本的php文件(eg. wamp/bin/php/php5.4.16),解压缩,重命名文件夹为php5.4.16,复制到wamp/bin/php下。
(2)从已存在的php版本文件中(如php5.3.10)复制以下文件: php.ini、phpForApache.ini和wampserver.conf到php5.4.16文件夹中.分别打开php.ini和phpForApache.ini把5.3.10替换为5.4.16。
(3)参照上面的步骤修改wampmanager.ini中的,添加
版权声明:本文为博主原创文章,未经博主允许不得转载。
页:
[1]