-1

I have installed xampp 8.0 in macbook. There is no xampp folder in "applications" folder. Xampp 8.0 is installed at

/Users/kamlesh/.bitnami/stackman/machines/xampp/volumes/root/htdocs/ 

phpmyadmin and phpinfo of xampp 8.0 are working in the browser. If I add a test.php file in htdocs directory then it also works in the browser.

Xampp 8.0 has php 8 version and I want to set its path in bash_profile file so that when I use "php -v" command in terminal then it should show php 8.0 version. I have set strings in bash_profile file as, but not working yet:

export XAMPP_HOME=/Users/kamlesh/.bitnami/stackman/machines/xampp/volumes/root
export PATH=${XAMPP_HOME}/bin:${PATH}
export PATH

I have also tried below settings in bash_profile file, but still not getting php 8 version in command line:

export PATH=/opt/lampp/bin:${PATH}
export PATH

Any suggestion will be highly appreciated. Thanks a lot friends.

Kamlesh
  • 5,233
  • 39
  • 50
  • what you mean with "not working"? do you have the message "php command not found"? – Giacomo M Apr 24 '21 at 05:35
  • Thanks for your keen interest @GiacomoM. I have installed xampp 8.0 version on mac machine but when i run "php -v" command in terminal it returns older version of php eg. "7.1.3" instead of xampp's php 8.0 version. Any suggestion. Please help. – Kamlesh Apr 24 '21 at 06:22
  • Due to not settings correct php path, in other words not having correct php 8.0 version - composer does not work and also if i setup laravel framework on system then run "php artisan......" command, it does not work because system does not have correct php version 8.0. How to setup xampp php path for composer and default php version on system? Thanks – Kamlesh Apr 24 '21 at 06:25
  • try with "which php" and you can see whats the path of your php version. – Giacomo M Apr 24 '21 at 06:49
  • Dear I have already used 'which php' command displaying mac's default php path instead of my latest installed xampp 8.0 path. Thats why showing php 7.1.3 version instead of xampp's php's 8.0 version. – Kamlesh Apr 24 '21 at 07:22
  • I have another idea, may be MAMP instead of Xampp will help me to solve all the issue. I try and get back to you. Thanks – Kamlesh Apr 24 '21 at 07:23
  • I have installed MAMP instead of Xampp and it solved all my problems. Thanks @GiacomoM :) – Kamlesh Apr 24 '21 at 14:01
  • Does this answer your question? [Update PHP to 7.4 macOS Catalina with brew](https://stackoverflow.com/questions/64684713/update-php-to-7-4-macos-catalina-with-brew) – Nico Haase Apr 24 '21 at 14:09
  • Or this? https://stackoverflow.com/questions/20523183/how-to-use-the-php-that-brew-installed – Nico Haase Apr 24 '21 at 14:09
  • Or this? https://stackoverflow.com/questions/41872645/updating-php-version-on-mac/56942162 – Nico Haase Apr 24 '21 at 14:09

1 Answers1

1

MAMP solved my all the problems. I have uninstalled Xampp because it is not built for Mac. I have added below strings in ~/.bash_profile file by command line:

export XAMPP_HOME=/Applications/MAMP/bin/php/php8.0.0
export PATH=${XAMPP_HOME}/bin:${PATH}
export PATH

Then closed the terminal and reopened again then checked php version by below command:

php -v

Output was 8.0

My composer is also using php 8.0 version now.

I hope, this will solve your problem also. Happy to help and share this solution :)

Kamlesh
  • 5,233
  • 39
  • 50