Change default Mac OS X PHP to XAMPP's PHP Installation & Install Composer Package Management for Laravel

0 Shares
0
0
0

First, Let’s find out what version of PHP we’re running (To find out if it’s the default version).
To do that, Within the terminal, Fire this command:

which php

This should output the path to the default PHP install which comes preinstalled by Mac OS X, by default it has to be (Assuming you’ve not changed it before):

/usr/bin/php

Now, I just need to swap this over to the PHP that is installed with MAMP, which is located at /Applications/XAMPP/bin/php

To do this, we need to edit the .bash_profile and add the MAMP version of PHP to the PATH variable.

Follow these simple steps

  1. Within the Terminal, run vim ~/.bash_profile
  2. Type i and then paste the following at the top of the file:
    export XAMPP_HOME=/Applications/XAMPP
    export PATH=${XAMPP_HOME}/bin:${PATH}
    export 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).

saved!

Reference Github and by Narayan Reddy