如何实际更改作曲家使用的PHP版本? [英] How to Actually change PHP Version that used by composer?

查看:65
本文介绍了如何实际更改作曲家使用的PHP版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对这个作曲家和laravel知识还很陌生,并且在 Windows 10 中使用 XAMPP .所以,对不起,如果我错过了什么.

I'm quite new to this composer and laravel stuff, and I'm using XAMPP in Windows 10.. so, sorry if I missed something.

首先,我在Windows上安装了作曲器,并使用 PHP V.5.6 作为作曲器上的默认php引擎,对于初学者来说,我可以开发 laravel >正常进行项目,直到 Laravel V.5.4 ..

At first I Install my composer on my windows, and I'm using PHP V.5.6 as default php engine on my composer, for starter i could develop my laravel project normally, atleast until Laravel V.5.4..

但是现在我安装了其他 XAMPP和PHP V.7.1 (在分区中"),当我尝试开发 Laravel V.5.5 应用程序时,我无法请免费开发新的 Laravel 应用程序,因为我的作曲家仍在 PHP V.5.6 上运行.由于某些原因,我需要同时使用我的两个 PHP版本,但仍然找不到在 Composer 使用的 PHP引擎之间进行切换的方法.strong> ..

but now i have install other XAMPP with PHP V.7.1 ("in Partition") and when I try to developing Laravel V.5.5 app, I couldn't develop my new Laravel App freely, because my composer still running on PHP V.5.6. For some reason I need both of my PHP version, and I still couldn't figure out a way to switch between PHP Engine that used by the Composer..

所以,我的问题是.是否有任何简单的方法即可更改composer使用的PHP版本,而无需安装/卸载它?

So, My Question is. Is there any simple way to change PHP Version used by composer without install/uninstalling it?

推荐答案

我真的不知道您如何运行作曲家脚本,因此我的回答对您可能毫无用处.

I don't really know how do you run the composer script so my answer can be useless for you.

您有两个不同版本的php,因此每个版本都有两个二进制文件,因此您可以从命令行使用所需的二进制文件来运行composer:

You have two different versions of php, so you have two binary files for each version, so you can use needed binary file to run the composer from your command line:

$ /path/to/needed/binary/php composer.phar install

但这可能是一个非常糟糕的主意.作曲家中的库可以依赖于其他库,而这些库可以依赖于php版本.您的作曲者正在加载依赖php版本的库,它们当前正在运行.因此,它可以加载在其他php版本中无法使用的库.

But it can be a really bad idea. Libraries in the composer can depend of others and those can depend from php version. Your composer loads libraries which are relying on php version wich is currently running. So it can load libraries which will not work in other php version.

这篇关于如何实际更改作曲家使用的PHP版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆