OSX 改变PHP安装路径环境变量

当使用XAMPP来学习Laravel的时候,用composer安装laravel总是报错,说mcrypt is required ,但是当我在终端里打印 which php 显示的是usr/bin/php 没有用XAMPP安装的PHP,所以要改成使用XAMPP中的PHP版本,做法如下:

To those that uses XAMPP 1.7.3 and Mac

  1. Go to Terminal
  2. Enterwhich php
    • If it says /usr/bin/php, then proceed to 3.
  3. Entersudo nano ~/.bash_profile(orsudo vim ~/.bash_profileif you know how to use it)
  4. Then paste thisexport PATH="/Applications/XAMPP/xamppfiles/bin:$PATH"
  5. Ctrl - O then enter to save, then ctrl - X to exit.
  6. Type cd ~
  7. type . .bash_profile
  8. restart terminal.
  9. Enterwhich php
Good luck

你可能感兴趣的:(环境变量)