当使用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.
原文,顺便吐槽一下他的排版.对原文略微改动