Last active
January 17, 2022 10:37
-
-
Save ParthaDhar/20431463cc749863c65419dea7582061 to your computer and use it in GitHub Desktop.
xampp version manager for ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Install any xammp version in your ubuntu | |
## Rename the /opt/lampp to any (eg. lampp72) | |
echo | |
echo -e "\033[1;31m XAMPP Switcher\e[0m" | |
echo | |
echo -e "\033[0;33m PHP version currently active in your '/opt/lampp': \033[0;35m`sudo /opt/lampp/bin/php -v | head -n 1 | cut -c 1-10` \e[0m" # Checking running php version | |
sudo /opt/lampp/lampp stop &>- # Stopping lampp stack if running | |
echo | |
echo -e "\033[0;31m versions that you have installed:\e[0m" | |
ls -ldt /opt/lampp* | awk '{print $9}' | |
echo | |
## Taking inputs | |
echo -e "\033[0;34m Write the PHP version currently active \033[1;31m(be careful)" | |
echo -e "\033[0;34m Please check the text in the \033[0;35mpurple\033[0;34m and" | |
echo -en " write eg. 72 for PHP 7.2.34: \e[0m" | |
read RUNVERSION | |
echo "$RUNVERSION"; | |
if [ -z "$1" ] ; then | |
echo -e "\033[0;34m" | |
echo "Write the PHP version you want to switch: " | |
echo "[72] for PHP 7.2" | |
echo "[74] for PHP 7.4" | |
echo "[80] for PHP 8.0" | |
echo -e "\e[0m" | |
read REQVERSION | |
else | |
REQVERSION=$1 | |
fi | |
echo "Version: " $REQVERSION | |
echo | |
## Rename directories | |
sudo mv /opt/lampp /opt/lampp$RUNVERSION | |
sudo mv /opt/lampp$REQVERSION /opt/lampp | |
sudo /opt/lampp/lampp start # Starting new version | |
echo -e "\033[0;32m Changed php version\e[0m" | |
sudo /opt/lampp/bin/php -v # Checking current php version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment