当使用XAMPP来学习Slim的时候,安装composer总是报错 ,但是当我在终端里打印 which PHP 显示的是usr/bin/php 用的是mac自带的php,没有用XAMPP安装的PHP,所以要改成使用XAMPP中的PHP版本,做法如下:
To those that uses XAMPP and Mac
Go to Terminal
Enter
which php
If it says /usr/bin/php , then go on.
Enter
sudo nano ~/.bash_profile
or
sudo vim ~/.bash_profile
Then paste this
export PATH="/Applications/XAMPP/xamppfiles/bin:$PATH"
Then save & exit
CTRL + O and CTRL + X
:wq
Type
cd ~
type
. .bash_profile
restart terminal.
Reopen terminal and enter
which php
that’s all,thinks.
原文,顺便吐槽一下他的排版.对原文略微改动
本文介绍如何解决在XAMPP环境下安装Composer时遇到的问题,并确保使用XAMPP自带的PHP版本而非系统默认版本。通过修改.bash_profile文件指定正确的PHP路径,可以顺利进行Slim框架的学习。

被折叠的 条评论
为什么被折叠?



