วันพฤหัสบดีที่ 1 มีนาคม พ.ศ. 2561

Change/Add php version on MAC (MAMP)

My new project runs on MAMP and it requires PHP 7.0 but PHP on my local machine is 7.1.
These are the best steps. I found them from this blog - https://gist.github.com/irazasyed/5987693

  1. Within the Terminal, run vim ~/.bash_profile
  2. Type i and then paste the following at the top of the file:
     export PATH=/Applications/MAMP/bin/php/php5.4.10/bin:$PATH
    
  3. Hit ESC, Type :wq, and hit Enter
  4. In Terminal, run source ~/.bash_profile
  5. In Terminal, type in which php again and look for the updated string. If everything was successful, It should output the new path to MAMP PHP install.
  6. In case it doesn't output the correct path, try closing the terminal window (exit fully) and open again, it should apply the changes (Restart in short).

Then I can command 'composer install' successfully!