MAMP指定PHP版本使用Composer

场景:安装phpoffice/phpspreadsheet需要zip拓展,composer require phpoffice/phpspreadsheet报错,没有zip拓展。因为我使用的是MAMP下的php。

方案:

1.把MAMP下的php复制到Mac环境变量目录,这步很关键。

cp /Applications/MAMP/bin/php/php7.2.8/bin/php /usr/local/bin/php728

2.从 https://getcomposer.org/download/ 下载composer.phar,放到项目根目录(例:/Applications/MAMP/htdocs/hd_kt_20200217_tp5.1 )

3.测试:php728 composer.phar -v

4.php728 composer.phar require phpoffice/phpspreadsheet

猜你喜欢

转载自blog.csdn.net/weixin_42450794/article/details/104892160
今日推荐