1.下载需要的PHP版本
下载地址:
https://windows.php.net/download#php-7.0
下载说明:
根据系统选择版本
64位选 VC14 x64 Thread Safe
32位选 VC14 x86 Thread Safe
当前笔者下载版本:php-7.1.23-Win32-VC14-x64.zip
2.下载VC14
下载地址:https://www.microsoft.com/en-US/download/details.aspx?id=48145
下载完成后,双击进行安装
3.在wamp/bin/php下创建文件夹
文件夹名称:php7.1.23
将下载的php-7.1.23-Win32-VC14-x64.zip解压后放到上面创建的文件中
复制php.ini-development重命名为php.ini
编辑php.ini文件,查找;extension_dir = "ext/"关键词,修改为extension_dir = "E:\wamp\bin\php\php7.1.23\ext"
复制php.ini文件,重命名为phpForApache.ini
4.将wamp/bin/php下原版本wampserver.conf复制到新版本的 php7.x.x文件夹下
5.编辑php7.x.x文件夹下的wampserver.conf文件
原内容:
$phpConf['apache']['2.2']['LoadModuleName'] = 'php5_module';
$phpConf['apache']['2.2']['LoadModuleFile'] = 'php5apache2_2.dll';
$phpConf['apache']['2.2']['AddModule'] = '';
$phpConf['apache']['2.4']['LoadModuleName'] = 'php5_module';
$phpConf['apache']['2.4']['LoadModuleFile'] = 'php5apache2_4.dll';
$phpConf['apache']['2.4']['AddModule'] = '';
修改后内容:
$phpConf['apache']['2.2']['LoadModuleName'] = 'php7_module';
$phpConf['apache']['2.2']['LoadModuleFile'] = 'php7apache2_2.dll';
$phpConf['apache']['2.2']['AddModule'] = '';
$phpConf['apache']['2.4']['LoadModuleName'] = 'php7_module';
$phpConf['apache']['2.4']['LoadModuleFile'] = 'php7apache2_4.dll';
$phpConf['apache']['2.4']['AddModule'] = '';
6.重新启动wampserver服务,启动后可以选择相应的php版本
7.在浏览器查看当前的php使用版本
var_dump(phpinfo());