use*_*492 7 php wamp wampserver php-7
我安装了Wampserver 3.0.6 32位,它带有PHP版本5.6.25和7.0.10.
当我从服务器托盘图标从5.6.25切换到7.0.10时,它不会更新我的电脑正在使用的实际php版本.
我可以在命令提示符下运行它来测试它php -v:
PHP 5.6.25 (cli) (built: Aug 18 2016 11:40:20)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
Run Code Online (Sandbox Code Playgroud)
重新启动wamp服务并多次重新打开终端后,它仍然显示相同的内容.
当我在浏览器中访问localhost时,它显示以下内容:
我不知道为什么它仍然显示PHP版本5.6.
有人有主意吗?
在Windows 10 64位操作系统上运行此命令.
使用WAMPServer服务器任务栏图标从5.6.25切换到7.0.10时,它仅更新Apache下使用的PHP版本。
它对 PHP CLI(命令行界面)中使用的PHP版本没有任何影响。
控制CLI使用的PHP版本的最简单方法是编写一个小的批处理文件,该文件将在命令Windows存在期间将正确的文件夹临时添加到Windows PATH。
NOTE: Avoid adding the php folder to the Windows PATH permanantly. As when you want to use a different version of PHP in the CLI you will forget to amend this, and a batch file like suggested in the other answer is so much more flexible.
As of WAMPServer 3.1.1 there is now a menu item that will change the PHP CLI version to any version of PHP that you have installed as an ADDON.
(right click) wampmanager->Tools->Change PHP CLI Version
Run Code Online (Sandbox Code Playgroud)
This only changes the version of PHP that the WAMPServer code will use when running its internal PHP based processes. It does not change the PHP CLI version
您终端中的版本和 wamp 使用的版本可能不同。
在 wamp 项目中创建一个 PHP 文件并将其放入其中。
<?php
phpinfo();
?>
Run Code Online (Sandbox Code Playgroud)
在浏览器中转到 PHP 文件的 URL,这将显示 wamp 中的 apache 服务器正在使用的 PHP 版本。您可以使用本教程更改它。 更改wamp中的PHP版本
祝你好运!