博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Wamp升级PHP版本
阅读量:5255 次
发布时间:2019-06-14

本文共 6699 字,大约阅读时间需要 22 分钟。

方法一:

1.  停止WAMP服务器.

2.  去网站 下载PHP 5.4 VC9 x86 Non Thread Safe

不要下载THE INSTALLER.

3.  在wamp/bin/php创建php5.4.45文件夹 

4.  把下载的zip包解压到php5.4.45文件夹中

5.  从已存在的php版本文件中(如php5.4.45, (eg.   wamp/bin/php/php5.3.3))复制以下文件: -  php.ini、phpForApache.ini和wampserver.conf到php5.4.45文件夹.

6.  打开php5.4.45文件夹的以下文件: -   php.ini和phpForApache.ini并且把5.2.5替换为5.4.45。

7.  去wamp/bin/apache/apache/apache2.2.11/bin删除php.ini文件。将5.2.5文件夹中的php5apache2_2.dll和php5apache2_2_filter.dll复制到php5.4.45中去(我就漏了这步导致无法启动)

 

修改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;

8.重启wamp.

9. 选择旧版本5.2.5

10. 选择后会重启wamp。

11. 此时就可以选择php->version-> 5.4.45 .

12. 重启成功.完成

 

必须要下载VC9处理器

 

方法二:

安装成功:先安装wampServer2.0,拷贝php5.2.5 出来,卸载,在安装wampserver2.1,版本php5.3.3

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.conf 到 Wamp的安装目录\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]
;WAMPPHPVERSIONSTART
Type: item; Caption: "5.2.17"; Action: multi; Actions:switchPhp5.2.17; Glyph: 13
Type: item; Caption: "5.3.0"; Action: multi; Actions:switchPhp5.3.0
Type: 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 waituntilterminated
Action: 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: waituntilterminated
Action: run; FileName: "D:/programs/wamp/bin/php/php5.3.0/php-win.exe";Parameters: "-c . refresh.php";WorkingDir: "D:/programs/wamp/scripts"; Flags: waituntilterminated
Action: run; FileName: "net"; Parameters: "start wampapache"; ShowCmd: hidden; Flags: waituntilterminated
Action: resetservices
Action: readconfig;
[switchPhp5.3.0]
Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
Action: 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: waituntilterminated
Action: run; FileName: "D:/programs/wamp/bin/php/php5.3.0/php-win.exe";Parameters: "-c . refresh.php";WorkingDir: "D:/programs/wamp/scripts"; Flags: waituntilterminated
Action: run; FileName: "net"; Parameters: "start wampapache"; ShowCmd: hidden; Flags: waituntilterminated
Action: resetservices
Action: readconfig;
;WAMPPHPVERSIONEND 

 

 

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

转载于:https://www.cnblogs.com/relix/p/5019636.html

你可能感兴趣的文章
YUV 格式的视频呈现
查看>>
Android弹出框的学习
查看>>
现代程序设计 作业1
查看>>
在android开发中添加外挂字体
查看>>
Zerver是一个C#开发的Nginx+PHP+Mysql+memcached+redis绿色集成开发环境
查看>>
多线程实现资源共享的问题学习与总结
查看>>
Learning-Python【26】:反射及内置方法
查看>>
torch教程[1]用numpy实现三层全连接神经网络
查看>>
java实现哈弗曼树
查看>>
转:Web 测试的创作与调试技术
查看>>
python学习笔记3-列表
查看>>
程序的静态链接,动态链接和装载 (补充)
查看>>
关于本博客说明
查看>>
线程androidAndroid ConditionVariable的用法
查看>>
转载:ASP.NET Core 在 JSON 文件中配置依赖注入
查看>>
socket初识
查看>>
磁盘测试工具
查看>>
代码变量、函数命名神奇网站
查看>>
redis cli命令
查看>>
Problem B: 占点游戏
查看>>