多个php版本的composer使用

因为项目中使用swoole开发,一直使用win10 ubuntu子系统开发,随着代码量的增加,每次启动越来越慢。swoole官方提供了一个windows版swoole,启动速度特别快。但是由于其使用cgwin编译,所以无法正常使用composer,每次都需要切换php的环境变量。于是就想能不能让composer 识别我原来的php版本。打开composer的根文件试试真的可以。

composer文件: D:\Program Files\composer\composer

(1).原代码:

#!/bin/sh

dir=$(cd "${0%[/\\]*}" > /dev/null; pwd)

if [[ -d /proc/cygdrive && $(which php) == $(readlink -n /proc/cygdrive)/* ]]; then
   # We are in Cgywin using Windows php, so the path must be translated
   dir=$(cygpath -m "$dir");
fi

php "${dir}/composer.phar" "$@"

(2).修改后代码

#!/bin/sh

dir=$(cd "${0%[/\\]*}" > /dev/null; pwd)

if [[ -d /proc/cygdrive && $(which php) == $(readlink -n /proc/cygdrive)/* ]]; then
   # We are in Cgywin using Windows php, so the path must be translated
   dir=$(cygpath -m "$dir");
fi

D:/phpStudy/PHPTutorial/php/php-7.0.12-nts/php "${dir}/composer.phar" "$@"

只是将php的地址修改下即可,让composer每次加载我的phpstudy的php版本

访客
邮箱
网址

通用的占位符缩略图

人工智能机器人,扫码免费帮你完成工作


  • 自动写文案
  • 自动写小说
  • 马上扫码让Ai帮你完成工作
通用的占位符缩略图

人工智能机器人,扫码免费帮你完成工作

  • 自动写论文
  • 自动写软件
  • 我不是人,但是我比人更聪明,我是强大的Ai
Top