laravel 如何为 Composer 分配/设置特定的 php 版本?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41908492/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 15:13:18  来源:igfitidea点击:

How to assign / set specific php version to composer?

phplaravelcomposer-phpwamp

提问by Prafulla Kumar Sahu

I have multiple versions of php installed on my wamp . now I am running PHP 7.0.15 as you can see in screenshot, but the laravel I am using is still taking 5.5.12 and I am unable t use laravelcollective .

我的 wamp 上安装了多个版本的 php。现在我正在运行 PHP 7.0.15,如您在屏幕截图中所见,但我使用的 laravel 仍在使用 5.5.12 并且我无法使用 laravelcollective 。

OS : Windows 10 Pro

操作系统:Windows 10 专业版

How I can fix it ?

我该如何解决?

enter image description here

在此处输入图片说明

Updated information

更新信息

E:\work\www\my-project>php --version
PHP 5.4.45 (cli) (built: Sep  2 2015 23:48:00)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

so, it seems my project is using 5.4.45 command line. may be I need to change it ? but having no idea of it.

所以,看来我的项目正在使用 5.4.45 命令行。我可能需要改变它吗?但不知道它。

回答by Prafulla Kumar Sahu

SOLVED, I fixed it by changing the %PATH%environment variable to fix it . I added path of all php versions I have to %PATH%, as per my requirement I can arrange it from top to bottom, as CLI will take the first one it will get from Top to bottom in environment variable setting.

已解决,我通过更改%PATH%环境变量来修复它。我添加了所有 php 版本的路径%PATH%,根据我的要求,我可以从上到下排列它,因为 CLI 将在环境变量设置中采用第一个从上到下的路径。

please check thisto have a better idea about my solution.

请检查这个以更好地了解我的解决方案。