user163831
user163831

Reputation: 1211

Change PHP path in OS X terminal to XAMPP PHP

I just installed Composer on OS X 10.8 and am now trying to use it to install something else and it turns out my terminal is running php 5.3... In XAMPP I have 5.5, so I would like to just use that version in Terminal as well. I tried creating a .bash_profile in my home directory with

export PATH=/Applications/XAMPP/xamppfiles/bin/php-5.5.11/bin:$PATH

but that wouldn't work; which php still returns /usr/bin/php. What am I missing here? Much thanks in advance.

Upvotes: 1

Views: 6721

Answers (2)

Ka Kui
Ka Kui

Reputation: 31

Here is my working Environment Path

export PATH="/Applications/XAMPP/xamppfiles/bin:$HOME/.composer/vendor/bin:/usr/local/sbin:$PATH"

Remember to wrap the path with double quotes and also close all terminal before checking the php version using

php -v or which php

Upvotes: 3

craigh
craigh

Reputation: 2291

If you aren't using a bash shell, then changing the bash_profile won't make a difference. bash apparently wasn't always the default, so on my mac, I am using .tcsh. I don't know why it uses one over the other, it has just always been that way (been upgrading macs since OS X 10.0). So on mine I have a .tcshrc file which operates like the bash_profile. In there I have

alias php /Applications/MAMP/bin/php/php5.6.7/bin/php

which you would obviously have to adjust to your own path and version, but you get the point.

Upvotes: 1

Related Questions