当前位置:首页 > 大杂烩 > 正文内容

多个php版本的composer使用

高老师7年前 (2018-12-27)大杂烩1957

因为项目中使用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版本

扫描二维码推送至手机访问。

版权声明:本文由高久峰个人博客发布,如需转载请注明出处。

本文链接:https://blog.20230611.cn/post/516.html

分享给朋友:

“多个php版本的composer使用” 的相关文章

c#中string和StringBuilder效率对比

c#中string和StringBuilder效率对比

    c#中string和StringBuilder直接看看执行速度。(2).String类型累计赋值Test               ...

Git本地仓库学习

Git本地仓库学习

1.全局用户信息设置 git  config  --global  user.name  gaojiufeng git  config  --global  user.email  392223903...

Application的错误使用

Application的错误使用

Application 对象用于存储和访问来自任意页面的变量,类似 Session 对象。不同之处在于所有的用户分享一个 Application 对象,而 session 对象和用户的关系是一一对应的。很多的书籍中介绍的Application对象都喜欢以统计在线人数来介绍Application 对象...

Git推送文件到远程仓库

Git推送文件到远程仓库

1.远程仓库的协作模式开发者把自己最新的版本推到线上仓库,同时把线上仓库的最新代码,拉到自己本地即可2.注册git帐号国外: http://www.github.com国内: http://git.oschina.net2.在码云创建项目,不要初始化readmegit push https://gi...

Git从远程仓库更新文件

Git从远程仓库更新文件

 git   pull  https://git.oschina.net/392223903/learn.git   master   换为您的git地址...

Git日志查看和版本切换

Git日志查看和版本切换

日志查看:git log版本切换:方式1:git  reset  --hard  HEAD^   倒退一个版本git  reset  --hard  HEAD^^  倒退两个版本方式2:(版本号的形式,建议版本号码补充完...