Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mac OSX PHP and XAMPP path issue

Tags:

I have installed XAMPP on Mac OSX running Yosemite I have created the .bash_profile file like this:

export XAMPP_HOME=/Applications/XAMPP/xamppfiles export PATH=${XAMPP_HOME}/bin/php:${PATH} export PATH 

When I type echo $PATH in terminal, I get correct XAMPP path But when I type "which php" it shows /usr/bin/php

How can I make my XAMPP use the correct php instead of default php that came with mac?

like image 613
ssdesign Avatar asked Nov 19 '14 08:11

ssdesign


People also ask

Where is PHP EXE in XAMPP Mac?

On a Linux or Mac OS X system, this may be available as the file /usr/bin/php. If you've installed XAMPP, you can use the program /opt/lampp/bin/php on Linux, /Applications/xampp/xamppfiles/bin/php on Mac OS X, and C:\Program Files\xampp\php\php.exe on Windows.


2 Answers

To use the XAMPP PHP and other binaries found in /Applications/XAMPP/bin/ by default this is the correct entry for ~/.bash_profile

export XAMPP_HOME=/Applications/XAMPP export PATH=${XAMPP_HOME}/bin:${PATH} export PATH 

Load the changes with this (won't be needed next time you open a shell session):

source ~/.bash_profile 

Confirm:

$ which php /Applications/XAMPP/bin/php 
like image 182
BlueC Avatar answered Oct 17 '22 17:10

BlueC


In My case I did the following

I created my bash profile.

sudo nano ~/.bash_profile

And then added the following to it

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

And then refreshed my path source ~/.bash_profile Or if that doesn't work you can close the terminal completely and start a new session.

Enter which php And you would see your new php path, in my case /Applications/XAMPP/xamppfiles/bin If you know what php version you installed, you can also check by entering php -v in my case it output the following.

PHP 5.6.14 (cli) (built: Nov 19 2015 20:37:15) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies.

like image 23
Daniel Barde Avatar answered Oct 17 '22 19:10

Daniel Barde