wamp集成环境怎样更新php

在 WampServer 上手工安装 PHP 的多个版本

WampServer是一个集成了PHP/Mysql/Apache及其它应用(如PhpMyAdmin/Xdebug[也许没有])的软件,它最令人喜爱的特征,不是令Php/Mysql/Apache的安装配置简单化,而是让我们只需要点点鼠标,就可以随意切换已经安装的PHP/Mysql/Apache的不同版本。对于PHP不同版本的需求,PHP程序员都最清楚不过了。

 

WampServer的Version菜单(Apache、PHP、Mysql各自有一个Version菜单)上,有一个 Get More... 连接,点击它就可以到官网上下载你需要的版本,安装是自动化的,非常简单。但是,到我写本文为止,官网的PHP5.2最高为5.2.11,PHP5.3最高为5.3.1。5.2最稳定的5.2.17、5.3最新的5.3.8都没有提供,而且更新非常慢。没有我们需要的版本,怎么办?毛大爷说过一句至理名言:自己动手,丰衣足食!

 

手工安装新版本的PHP,只需以下步骤:

  1. 下载要安装的PHP版本。既然是用WampServer,那当然是下载Window版本的ZIP包啦:http://windows.php.net。解压到 Wamp的安装目录\bin\php\php5.2.17。这里以5.2.17为例。
  2. 进入 Wamp的安装目录\bin\php\php5.2.17 目录,从 php.ini-dist 或者 php.ini-recommended 复制一份,重命名为php.ini,适应修改php.ini配置(如extension_dir),再从php.ini复制一分,重命名为 phpForApache.ini
  3. 从已有的版本目录中复制一份 wampserver.conf。比如我安装WampServer的时候已经有php5.3.0,在 Wamp的安装目录\bin\php\php5.3.0 目录下复制 wampserver.confWamp的安装目录\bin\php\php5.2.17
  4. 修改Wamp配置文件:进入 Wamp的安装目录,用IDE或记事本(最好使用行号定位的记事本,如EditPlus等)打开 wampmanager.ini,定位到 335 行,通常在这一行就是[phpVersion],如果不是,则在附近找找。复制下面一行:    
    Type: item; Caption: "5.3.0"; Action: multi; Actions:switchPhp5.3.0 插入到这一行前面,并修改为    
    Type: item; Caption: "5.2.17"; Action: multi; Actions:switchPhp5.2.17
    再复制
    [switchPhp5.3.0]      Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors waituntilterminated      Action: run; FileName: " Wamp的安装目录/bin/php/php5.3.0/php-win.exe";Parameters: "switchPhpVersion.php 5.3.0";WorkingDir: " Wamp的安装目录/scripts"; Flags: waituntilterminated      Action: run; FileName: " Wamp的安装目录/bin/php/php5.3.0/php-win.exe";Parameters: "-c . refresh.php";WorkingDir: " Wamp的安装目录/scripts"; Flags: waituntilterminated      Action: run; FileName: "net"; Parameters: "start wampapache"; ShowCmd: hidden; Flags: waituntilterminated      Action: resetservices      Action: readconfig;
    插入这一段之前,并修改为
    [switchPhp 5.2.17]      Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
    Action: run; FileName: " Wamp的安装目录/bin/php/php5.3.0/php-win.exe";Parameters: "switchPhpVersion.php 5.2.17";WorkingDir: " Wamp的安装目录/scripts"; Flags: waituntilterminated      Action: run; FileName: " Wamp的安装目录/bin/php/php5.3.0/php-win.exe";Parameters: "-c . refresh.php";WorkingDir: " Wamp的安装目录/scripts"; Flags: waituntilterminated
         Action: run; FileName: "net"; Parameters: "start wampapache"; ShowCmd: hidden; Flags: waituntilterminated      Action: resetservices      Action: readconfig;
  5. 退出WampServer,再重启。完成。

通过这5步,即可完成PHP任意版本的安装。

另附两个文件的实例:

1. Wamp的安装目录\bin\php\php5.2.17\wampserver.conf,这实际是PHP文件

复制代码
<?php
$phpConf['phpIniDir'] = '.'; $phpConf['phpExeDir'] = '.'; $phpConf['phpConfFile'] = 'php.ini';
$phpConf['apache']['1.3']['LoadModuleName'] = 'php5_module'; $phpConf['apache']['1.3']['LoadModuleFile'] = 'php5apache.dll'; $phpConf['apache']['1.3']['AddModule'] =  'mod_php5.c';
$phpConf['apache']['2.0']['LoadModuleName'] = 'php5_module'; $phpConf['apache']['2.0']['LoadModuleFile'] = 'php5apache2.dll'; $phpConf['apache']['2.0']['AddModule'] =  '';
$phpConf['apache']['2.2']['LoadModuleName'] = 'php5_module'; $phpConf['apache']['2.2']['LoadModuleFile'] = 'php5apache2_2.dll'; $phpConf['apache']['2.2']['AddModule'] =  '';
?>
复制代码

 

2. Wamp的安装目录\wampmanager.ini

复制代码
[ phpVersion ] ; WAMPPHPVERSIONSTARTType: item ; Caption: "5.2.17"; Action: multi; Actions:switchPhp5.2.17; Glyph: 13Type: item ; Caption: "5.3.0"; Action: multi; Actions:switchPhp5.3.0Type: separator ; Type: item ; Caption: "Get more..."; Action: run; FileName: "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"; Parameters: "http://www.wampserver.com/addons_php.php"; [ switchPhp5.2.17 ] Action: service ; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors waituntilterminatedAction: run ; FileName: "D:/programs/wamp/bin/php/php5.3.0/php-win.exe";Parameters: "switchPhpVersion.php 5.2.17";WorkingDir: "D:/programs/wamp/scripts"; Flags: waituntilterminatedAction: run ; FileName: "D:/programs/wamp/bin/php/php5.3.0/php-win.exe";Parameters: "-c . refresh.php";WorkingDir: "D:/programs/wamp/scripts"; Flags: waituntilterminatedAction: run ; FileName: "net"; Parameters: "start wampapache"; ShowCmd: hidden; Flags: waituntilterminatedAction: resetservices Action: readconfig ; [ switchPhp5.3.0 ] Action: service ; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors waituntilterminatedAction: run ; FileName: "D:/programs/wamp/bin/php/php5.3.0/php-win.exe";Parameters: "switchPhpVersion.php 5.3.0";WorkingDir: "D:/programs/wamp/scripts"; Flags: waituntilterminatedAction: run ; FileName: "D:/programs/wamp/bin/php/php5.3.0/php-win.exe";Parameters: "-c . refresh.php";WorkingDir: "D:/programs/wamp/scripts"; Flags: waituntilterminatedAction: run ; FileName: "net"; Parameters: "start wampapache"; ShowCmd: hidden; Flags: waituntilterminatedAction: resetservices Action: readconfig ; ; WAMPPHPVERSIONEND
复制代码

 

 

如果要复制以上文件,注意更改版本号与路径。

 
转自: http://www.cnblogs.com/heiing/archive/2011/11/15/2249948.html

转载于:https://www.cnblogs.com/kasery/archive/2013/01/31/2886829.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值