多个项目同时需要使用Composer,但是PHP版本不一样.
多个PHP
1
| D:\app\phpStudy\PHPTutorial\php\php-7.2.1-nts
|
将这个目录下的php.exe
复制修改成php7.exe
,删除php.exe
即可.
1 2 3 4
| $ php7 -v PHP 7.2.1 (cli) (built: Jan 4 2018 04:28:54) ( NTS MSVC15 (Visual C++ 2017) x86 ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies
|
1
| D:\app\phpStudy\PHPTutorial\php\php-5.5.38
|
1 2 3 4
| $ php -v PHP 5.5.38 (cli) (built: Jul 20 2016 11:16:06) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
|
多个PHP的Composer配置
- 直接安装的对应一个全局的Composer
- 配置一个需求版本的Composer
例如: 我们需要安装的对应php7.1的composer
- 下载composer,
https://getcomposer.org/download/
,将下载的composer.phar
移动到~/composer7
目录下
- 配置composer7
1 2 3
| vim ~/.bash_profile alias composer7='php7 D:/composer7/composer.phar' source ~/.bash_profile
|