I have XAMPP installed on my mac, and I want to make command line PHP use the same executable as XAMPP since I've customized that php's php.ini file.

The php binary I want is located at:


A quick check of where my CLI php is coming from says:

Casey-Flynns-MacBook-Air:~ casey$ whereis php

I've tried adding the following line to my ~/.bash_profile:

export PATH=/Applications/XAMPP//xamppfiles/bin/:$PATH

And a quick test of my $PATH global says its:

    Casey-Flynns-MacBook-Air:~ casey$ echo $PATH

But still when I execute 'php' from my command line it uses the binary I don't want. Anyone know what might be going on?


See man whereis:

The path searched is the string returned by the sysctl(8) utility for the ``user.cs_path'' string.

Which is on my Mac OS X:
$ sysctl user.cs_path
user.cs_path = /usr/bin:/bin:/usr/sbin:/sbin

Rather use which to verify what your shell would use:
$ echo $PATH
$ which php

Still I think it's not nice to have two programs with the same name in your $PATH, but I see no better solution (I don't think you can get rid of the preinstalled php and removing /usr/bin from PATH is also not really good...).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.