How to install multiple versions of XAMPP?












1















I'm having trouble installing multiple versions of XAMPP on my machine. I am currently using version 1.7.7 and installed it in /opt/lampp, but I also need to install the previous version which is version 1.7.1. So I downloaded and installed version 1.7.1 in /opt/lampp2.



But when I run /opt/lampp2/lampp startcommand to start 1.7.1 version, why does XAMPP show that the version that is currently running is 1.7.7, when it should be 1.7.1?










share|improve this question

























  • You should call it "XAMPP for Linux" to avoid confusion with LAMP.

    – Oli
    Oct 11 '12 at 11:34











  • is that way we need you put some code as example on the aswers! ALL links are DOWN!

    – rafaelphp
    Jul 14 '16 at 23:33
















1















I'm having trouble installing multiple versions of XAMPP on my machine. I am currently using version 1.7.7 and installed it in /opt/lampp, but I also need to install the previous version which is version 1.7.1. So I downloaded and installed version 1.7.1 in /opt/lampp2.



But when I run /opt/lampp2/lampp startcommand to start 1.7.1 version, why does XAMPP show that the version that is currently running is 1.7.7, when it should be 1.7.1?










share|improve this question

























  • You should call it "XAMPP for Linux" to avoid confusion with LAMP.

    – Oli
    Oct 11 '12 at 11:34











  • is that way we need you put some code as example on the aswers! ALL links are DOWN!

    – rafaelphp
    Jul 14 '16 at 23:33














1












1








1


2






I'm having trouble installing multiple versions of XAMPP on my machine. I am currently using version 1.7.7 and installed it in /opt/lampp, but I also need to install the previous version which is version 1.7.1. So I downloaded and installed version 1.7.1 in /opt/lampp2.



But when I run /opt/lampp2/lampp startcommand to start 1.7.1 version, why does XAMPP show that the version that is currently running is 1.7.7, when it should be 1.7.1?










share|improve this question
















I'm having trouble installing multiple versions of XAMPP on my machine. I am currently using version 1.7.7 and installed it in /opt/lampp, but I also need to install the previous version which is version 1.7.1. So I downloaded and installed version 1.7.1 in /opt/lampp2.



But when I run /opt/lampp2/lampp startcommand to start 1.7.1 version, why does XAMPP show that the version that is currently running is 1.7.7, when it should be 1.7.1?







xampp






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 12 '12 at 4:21







abdgstywn

















asked Oct 11 '12 at 10:37









abdgstywnabdgstywn

613




613













  • You should call it "XAMPP for Linux" to avoid confusion with LAMP.

    – Oli
    Oct 11 '12 at 11:34











  • is that way we need you put some code as example on the aswers! ALL links are DOWN!

    – rafaelphp
    Jul 14 '16 at 23:33



















  • You should call it "XAMPP for Linux" to avoid confusion with LAMP.

    – Oli
    Oct 11 '12 at 11:34











  • is that way we need you put some code as example on the aswers! ALL links are DOWN!

    – rafaelphp
    Jul 14 '16 at 23:33

















You should call it "XAMPP for Linux" to avoid confusion with LAMP.

– Oli
Oct 11 '12 at 11:34





You should call it "XAMPP for Linux" to avoid confusion with LAMP.

– Oli
Oct 11 '12 at 11:34













is that way we need you put some code as example on the aswers! ALL links are DOWN!

– rafaelphp
Jul 14 '16 at 23:33





is that way we need you put some code as example on the aswers! ALL links are DOWN!

– rafaelphp
Jul 14 '16 at 23:33










2 Answers
2






active

oldest

votes


















1














The solution is have separate directories and create a sym link to /opt/lampp



Keep 1.7.7 as /opt/lampp.1_7_7 and 1.7.1 as /opt/lampp.1_7_1 you can create a sym link to /opt/lampp. Based on the version choice you can change the sym link.



But the pain is if you have to switch versions you have delete the link and recreate a new one. So to avoid this, I found a script that can do the job.



Refer to this article (dead link, web.archive.org backup) to create the sym link



Script can help you to:





  • gives a choice of available versions of XAMPP (based on folder names
    containing them, based on the pattern shown above),

  • stops the XAMPP
    server processes,

  • deletes the existing lampp soft link,

  • creates a new
    soft link pointing at the folder containing the the chosen version of
    XAMPP.


Source







share|improve this answer


























  • is that way we need you put some code as example on the aswers! ALL links are DOWN!

    – rafaelphp
    Jul 14 '16 at 23:33











  • links are not working anymore

    – Rohan Khude
    Jan 2 '18 at 7:47



















0














Follow the idea to create a link, I try to make this works.
Remember that I am not a pro, I was looking for a solution and make this script to my self and share with you.



Just to future questions if you want to install 2 versions of xampp on Linux you have to install: Example:
xampp php5 on /opt/lampp then rename it to /opt/lampp5, then do the same with the php7 bin installer (or tar) and rename it to /opt/lampp7.
then copy this code into a new script.sh file, make it writable chmod +x script.sh, then run it $ ./script.sh or $ ./script.sh 5 start
here is the code example running fine on ubuntu 16.04, its just a simple script to make it work on this kind of problem, since on windows we can do it at the installation steps.



#!/bin/bash

LAMPP_VERSION=$1
LAMPP_ACTION=$2

LAMPP="/opt/lampp"
XAMPP=$LAMPP"/xampp"

function stopall {
sudo $XAMPP stopapache
sudo $XAMPP stopmysql
}

function startall {
sudo $XAMPP startapache
sudo $XAMPP startmysql
}

function stopmysql {
sudo $XAMPP stopmysql
}

function stopapache {
sudo $XAMPP stopapache
}

function startmysql {
sudo $XAMPP startmysql
}

function startapache {
sudo $XAMPP startapache
}

function checklampplink {

# check if exist a link and delete it
if [[ -L "$LAMPP" && -d "$LAMPP" ]]
then
echo "$LAMPP is a symlink to a directory: try DELETE!"
sudo rm -f $LAMPP
else
echo "NO $LAMPP LINK WAS FOUND!"
fi

# create a new link
echo "try to create LAMPP link ..."
cd /opt
ln -s "$LAMPP$LAMPP_VERSION" "lampp"

## check if is created
if [[ -L "$LAMPP" && -d "$LAMPP" ]];
then
echo $LAMPP "created!"
else
echo "LINK not created! exit 1"
exit 1
fi
}

function checkservices {

# check if services exists and try to stop property
PIDS_MYSQL=$(ps -C mysqld -C mysqld_safe -o pid=)
PIDS_APACHE=$(ps -C /opt/lampp/bin/ -o pid=)

if [ -n $PIDS_MYSQL ];
then
stopmysql
else
echo "NO MYSQL TO KILL"
fi
if [ -n "$PIDS_APACHE" ];
then
stopapache
else
echo "NO APACHE TO KILL"
fi

}

### begin ###



####
# get an action
if [ -z $LAMPP_ACTION ];
then
echo
echo "ACTION: ( start | stop | restart)?"
read LAMPP_ACTION
else
echo "ACTION SET TO: "$LAMPP_ACTION
fi
# if action is stop exit
if [ "$LAMPP_ACTION" == "stop" ];
then
stopall
exit 0
fi

####
# get a version
if [ -z $LAMPP_VERSION ];
then
echo
echo "VERSION: ( 5 | 7 )? "
read LAMPP_VERSION
else
echo "VERSION SET TO: " $LAMPP_VERSION
fi
if [[ "$LAMPP_VERSION" = "5" || "$LAMPP_VERSION" = "7" ]];
then
echo "GOOD version continue ..."
else
echo "Wrong version exit 1"
exit 1
fi

## if action is start or restart do the same
checkservices

# check folder link
checklampplink

echo

echo "Select an option to START:"
echo "1) ALL current installed services on xampp"
echo "2) Apache and Mysql - phpmyadmin"
echo
echo "Type enter to start option default ( 1 ) "
read USER_START
echo
echo "Starting services ..."
echo

if [ -z $USER_START ];
then
startapache
startmysql
else
if [ "$USER_START" = "1" ];
then
startall
else
startapache
startmysql
fi
fi

echo "Done";
exit 0


if this code have any syntax problem, sorry I just paste here.
good luck!






share|improve this answer
























  • github.com/rafaelphp/lampp_switcher

    – rafaelphp
    May 12 '17 at 13:25











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f198876%2fhow-to-install-multiple-versions-of-xampp%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














The solution is have separate directories and create a sym link to /opt/lampp



Keep 1.7.7 as /opt/lampp.1_7_7 and 1.7.1 as /opt/lampp.1_7_1 you can create a sym link to /opt/lampp. Based on the version choice you can change the sym link.



But the pain is if you have to switch versions you have delete the link and recreate a new one. So to avoid this, I found a script that can do the job.



Refer to this article (dead link, web.archive.org backup) to create the sym link



Script can help you to:





  • gives a choice of available versions of XAMPP (based on folder names
    containing them, based on the pattern shown above),

  • stops the XAMPP
    server processes,

  • deletes the existing lampp soft link,

  • creates a new
    soft link pointing at the folder containing the the chosen version of
    XAMPP.


Source







share|improve this answer


























  • is that way we need you put some code as example on the aswers! ALL links are DOWN!

    – rafaelphp
    Jul 14 '16 at 23:33











  • links are not working anymore

    – Rohan Khude
    Jan 2 '18 at 7:47
















1














The solution is have separate directories and create a sym link to /opt/lampp



Keep 1.7.7 as /opt/lampp.1_7_7 and 1.7.1 as /opt/lampp.1_7_1 you can create a sym link to /opt/lampp. Based on the version choice you can change the sym link.



But the pain is if you have to switch versions you have delete the link and recreate a new one. So to avoid this, I found a script that can do the job.



Refer to this article (dead link, web.archive.org backup) to create the sym link



Script can help you to:





  • gives a choice of available versions of XAMPP (based on folder names
    containing them, based on the pattern shown above),

  • stops the XAMPP
    server processes,

  • deletes the existing lampp soft link,

  • creates a new
    soft link pointing at the folder containing the the chosen version of
    XAMPP.


Source







share|improve this answer


























  • is that way we need you put some code as example on the aswers! ALL links are DOWN!

    – rafaelphp
    Jul 14 '16 at 23:33











  • links are not working anymore

    – Rohan Khude
    Jan 2 '18 at 7:47














1












1








1







The solution is have separate directories and create a sym link to /opt/lampp



Keep 1.7.7 as /opt/lampp.1_7_7 and 1.7.1 as /opt/lampp.1_7_1 you can create a sym link to /opt/lampp. Based on the version choice you can change the sym link.



But the pain is if you have to switch versions you have delete the link and recreate a new one. So to avoid this, I found a script that can do the job.



Refer to this article (dead link, web.archive.org backup) to create the sym link



Script can help you to:





  • gives a choice of available versions of XAMPP (based on folder names
    containing them, based on the pattern shown above),

  • stops the XAMPP
    server processes,

  • deletes the existing lampp soft link,

  • creates a new
    soft link pointing at the folder containing the the chosen version of
    XAMPP.


Source







share|improve this answer















The solution is have separate directories and create a sym link to /opt/lampp



Keep 1.7.7 as /opt/lampp.1_7_7 and 1.7.1 as /opt/lampp.1_7_1 you can create a sym link to /opt/lampp. Based on the version choice you can change the sym link.



But the pain is if you have to switch versions you have delete the link and recreate a new one. So to avoid this, I found a script that can do the job.



Refer to this article (dead link, web.archive.org backup) to create the sym link



Script can help you to:





  • gives a choice of available versions of XAMPP (based on folder names
    containing them, based on the pattern shown above),

  • stops the XAMPP
    server processes,

  • deletes the existing lampp soft link,

  • creates a new
    soft link pointing at the folder containing the the chosen version of
    XAMPP.


Source








share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 8 at 11:17









pomsky

30.7k1194127




30.7k1194127










answered Oct 11 '12 at 11:57









devav2devav2

24.8k126979




24.8k126979













  • is that way we need you put some code as example on the aswers! ALL links are DOWN!

    – rafaelphp
    Jul 14 '16 at 23:33











  • links are not working anymore

    – Rohan Khude
    Jan 2 '18 at 7:47



















  • is that way we need you put some code as example on the aswers! ALL links are DOWN!

    – rafaelphp
    Jul 14 '16 at 23:33











  • links are not working anymore

    – Rohan Khude
    Jan 2 '18 at 7:47

















is that way we need you put some code as example on the aswers! ALL links are DOWN!

– rafaelphp
Jul 14 '16 at 23:33





is that way we need you put some code as example on the aswers! ALL links are DOWN!

– rafaelphp
Jul 14 '16 at 23:33













links are not working anymore

– Rohan Khude
Jan 2 '18 at 7:47





links are not working anymore

– Rohan Khude
Jan 2 '18 at 7:47













0














Follow the idea to create a link, I try to make this works.
Remember that I am not a pro, I was looking for a solution and make this script to my self and share with you.



Just to future questions if you want to install 2 versions of xampp on Linux you have to install: Example:
xampp php5 on /opt/lampp then rename it to /opt/lampp5, then do the same with the php7 bin installer (or tar) and rename it to /opt/lampp7.
then copy this code into a new script.sh file, make it writable chmod +x script.sh, then run it $ ./script.sh or $ ./script.sh 5 start
here is the code example running fine on ubuntu 16.04, its just a simple script to make it work on this kind of problem, since on windows we can do it at the installation steps.



#!/bin/bash

LAMPP_VERSION=$1
LAMPP_ACTION=$2

LAMPP="/opt/lampp"
XAMPP=$LAMPP"/xampp"

function stopall {
sudo $XAMPP stopapache
sudo $XAMPP stopmysql
}

function startall {
sudo $XAMPP startapache
sudo $XAMPP startmysql
}

function stopmysql {
sudo $XAMPP stopmysql
}

function stopapache {
sudo $XAMPP stopapache
}

function startmysql {
sudo $XAMPP startmysql
}

function startapache {
sudo $XAMPP startapache
}

function checklampplink {

# check if exist a link and delete it
if [[ -L "$LAMPP" && -d "$LAMPP" ]]
then
echo "$LAMPP is a symlink to a directory: try DELETE!"
sudo rm -f $LAMPP
else
echo "NO $LAMPP LINK WAS FOUND!"
fi

# create a new link
echo "try to create LAMPP link ..."
cd /opt
ln -s "$LAMPP$LAMPP_VERSION" "lampp"

## check if is created
if [[ -L "$LAMPP" && -d "$LAMPP" ]];
then
echo $LAMPP "created!"
else
echo "LINK not created! exit 1"
exit 1
fi
}

function checkservices {

# check if services exists and try to stop property
PIDS_MYSQL=$(ps -C mysqld -C mysqld_safe -o pid=)
PIDS_APACHE=$(ps -C /opt/lampp/bin/ -o pid=)

if [ -n $PIDS_MYSQL ];
then
stopmysql
else
echo "NO MYSQL TO KILL"
fi
if [ -n "$PIDS_APACHE" ];
then
stopapache
else
echo "NO APACHE TO KILL"
fi

}

### begin ###



####
# get an action
if [ -z $LAMPP_ACTION ];
then
echo
echo "ACTION: ( start | stop | restart)?"
read LAMPP_ACTION
else
echo "ACTION SET TO: "$LAMPP_ACTION
fi
# if action is stop exit
if [ "$LAMPP_ACTION" == "stop" ];
then
stopall
exit 0
fi

####
# get a version
if [ -z $LAMPP_VERSION ];
then
echo
echo "VERSION: ( 5 | 7 )? "
read LAMPP_VERSION
else
echo "VERSION SET TO: " $LAMPP_VERSION
fi
if [[ "$LAMPP_VERSION" = "5" || "$LAMPP_VERSION" = "7" ]];
then
echo "GOOD version continue ..."
else
echo "Wrong version exit 1"
exit 1
fi

## if action is start or restart do the same
checkservices

# check folder link
checklampplink

echo

echo "Select an option to START:"
echo "1) ALL current installed services on xampp"
echo "2) Apache and Mysql - phpmyadmin"
echo
echo "Type enter to start option default ( 1 ) "
read USER_START
echo
echo "Starting services ..."
echo

if [ -z $USER_START ];
then
startapache
startmysql
else
if [ "$USER_START" = "1" ];
then
startall
else
startapache
startmysql
fi
fi

echo "Done";
exit 0


if this code have any syntax problem, sorry I just paste here.
good luck!






share|improve this answer
























  • github.com/rafaelphp/lampp_switcher

    – rafaelphp
    May 12 '17 at 13:25
















0














Follow the idea to create a link, I try to make this works.
Remember that I am not a pro, I was looking for a solution and make this script to my self and share with you.



Just to future questions if you want to install 2 versions of xampp on Linux you have to install: Example:
xampp php5 on /opt/lampp then rename it to /opt/lampp5, then do the same with the php7 bin installer (or tar) and rename it to /opt/lampp7.
then copy this code into a new script.sh file, make it writable chmod +x script.sh, then run it $ ./script.sh or $ ./script.sh 5 start
here is the code example running fine on ubuntu 16.04, its just a simple script to make it work on this kind of problem, since on windows we can do it at the installation steps.



#!/bin/bash

LAMPP_VERSION=$1
LAMPP_ACTION=$2

LAMPP="/opt/lampp"
XAMPP=$LAMPP"/xampp"

function stopall {
sudo $XAMPP stopapache
sudo $XAMPP stopmysql
}

function startall {
sudo $XAMPP startapache
sudo $XAMPP startmysql
}

function stopmysql {
sudo $XAMPP stopmysql
}

function stopapache {
sudo $XAMPP stopapache
}

function startmysql {
sudo $XAMPP startmysql
}

function startapache {
sudo $XAMPP startapache
}

function checklampplink {

# check if exist a link and delete it
if [[ -L "$LAMPP" && -d "$LAMPP" ]]
then
echo "$LAMPP is a symlink to a directory: try DELETE!"
sudo rm -f $LAMPP
else
echo "NO $LAMPP LINK WAS FOUND!"
fi

# create a new link
echo "try to create LAMPP link ..."
cd /opt
ln -s "$LAMPP$LAMPP_VERSION" "lampp"

## check if is created
if [[ -L "$LAMPP" && -d "$LAMPP" ]];
then
echo $LAMPP "created!"
else
echo "LINK not created! exit 1"
exit 1
fi
}

function checkservices {

# check if services exists and try to stop property
PIDS_MYSQL=$(ps -C mysqld -C mysqld_safe -o pid=)
PIDS_APACHE=$(ps -C /opt/lampp/bin/ -o pid=)

if [ -n $PIDS_MYSQL ];
then
stopmysql
else
echo "NO MYSQL TO KILL"
fi
if [ -n "$PIDS_APACHE" ];
then
stopapache
else
echo "NO APACHE TO KILL"
fi

}

### begin ###



####
# get an action
if [ -z $LAMPP_ACTION ];
then
echo
echo "ACTION: ( start | stop | restart)?"
read LAMPP_ACTION
else
echo "ACTION SET TO: "$LAMPP_ACTION
fi
# if action is stop exit
if [ "$LAMPP_ACTION" == "stop" ];
then
stopall
exit 0
fi

####
# get a version
if [ -z $LAMPP_VERSION ];
then
echo
echo "VERSION: ( 5 | 7 )? "
read LAMPP_VERSION
else
echo "VERSION SET TO: " $LAMPP_VERSION
fi
if [[ "$LAMPP_VERSION" = "5" || "$LAMPP_VERSION" = "7" ]];
then
echo "GOOD version continue ..."
else
echo "Wrong version exit 1"
exit 1
fi

## if action is start or restart do the same
checkservices

# check folder link
checklampplink

echo

echo "Select an option to START:"
echo "1) ALL current installed services on xampp"
echo "2) Apache and Mysql - phpmyadmin"
echo
echo "Type enter to start option default ( 1 ) "
read USER_START
echo
echo "Starting services ..."
echo

if [ -z $USER_START ];
then
startapache
startmysql
else
if [ "$USER_START" = "1" ];
then
startall
else
startapache
startmysql
fi
fi

echo "Done";
exit 0


if this code have any syntax problem, sorry I just paste here.
good luck!






share|improve this answer
























  • github.com/rafaelphp/lampp_switcher

    – rafaelphp
    May 12 '17 at 13:25














0












0








0







Follow the idea to create a link, I try to make this works.
Remember that I am not a pro, I was looking for a solution and make this script to my self and share with you.



Just to future questions if you want to install 2 versions of xampp on Linux you have to install: Example:
xampp php5 on /opt/lampp then rename it to /opt/lampp5, then do the same with the php7 bin installer (or tar) and rename it to /opt/lampp7.
then copy this code into a new script.sh file, make it writable chmod +x script.sh, then run it $ ./script.sh or $ ./script.sh 5 start
here is the code example running fine on ubuntu 16.04, its just a simple script to make it work on this kind of problem, since on windows we can do it at the installation steps.



#!/bin/bash

LAMPP_VERSION=$1
LAMPP_ACTION=$2

LAMPP="/opt/lampp"
XAMPP=$LAMPP"/xampp"

function stopall {
sudo $XAMPP stopapache
sudo $XAMPP stopmysql
}

function startall {
sudo $XAMPP startapache
sudo $XAMPP startmysql
}

function stopmysql {
sudo $XAMPP stopmysql
}

function stopapache {
sudo $XAMPP stopapache
}

function startmysql {
sudo $XAMPP startmysql
}

function startapache {
sudo $XAMPP startapache
}

function checklampplink {

# check if exist a link and delete it
if [[ -L "$LAMPP" && -d "$LAMPP" ]]
then
echo "$LAMPP is a symlink to a directory: try DELETE!"
sudo rm -f $LAMPP
else
echo "NO $LAMPP LINK WAS FOUND!"
fi

# create a new link
echo "try to create LAMPP link ..."
cd /opt
ln -s "$LAMPP$LAMPP_VERSION" "lampp"

## check if is created
if [[ -L "$LAMPP" && -d "$LAMPP" ]];
then
echo $LAMPP "created!"
else
echo "LINK not created! exit 1"
exit 1
fi
}

function checkservices {

# check if services exists and try to stop property
PIDS_MYSQL=$(ps -C mysqld -C mysqld_safe -o pid=)
PIDS_APACHE=$(ps -C /opt/lampp/bin/ -o pid=)

if [ -n $PIDS_MYSQL ];
then
stopmysql
else
echo "NO MYSQL TO KILL"
fi
if [ -n "$PIDS_APACHE" ];
then
stopapache
else
echo "NO APACHE TO KILL"
fi

}

### begin ###



####
# get an action
if [ -z $LAMPP_ACTION ];
then
echo
echo "ACTION: ( start | stop | restart)?"
read LAMPP_ACTION
else
echo "ACTION SET TO: "$LAMPP_ACTION
fi
# if action is stop exit
if [ "$LAMPP_ACTION" == "stop" ];
then
stopall
exit 0
fi

####
# get a version
if [ -z $LAMPP_VERSION ];
then
echo
echo "VERSION: ( 5 | 7 )? "
read LAMPP_VERSION
else
echo "VERSION SET TO: " $LAMPP_VERSION
fi
if [[ "$LAMPP_VERSION" = "5" || "$LAMPP_VERSION" = "7" ]];
then
echo "GOOD version continue ..."
else
echo "Wrong version exit 1"
exit 1
fi

## if action is start or restart do the same
checkservices

# check folder link
checklampplink

echo

echo "Select an option to START:"
echo "1) ALL current installed services on xampp"
echo "2) Apache and Mysql - phpmyadmin"
echo
echo "Type enter to start option default ( 1 ) "
read USER_START
echo
echo "Starting services ..."
echo

if [ -z $USER_START ];
then
startapache
startmysql
else
if [ "$USER_START" = "1" ];
then
startall
else
startapache
startmysql
fi
fi

echo "Done";
exit 0


if this code have any syntax problem, sorry I just paste here.
good luck!






share|improve this answer













Follow the idea to create a link, I try to make this works.
Remember that I am not a pro, I was looking for a solution and make this script to my self and share with you.



Just to future questions if you want to install 2 versions of xampp on Linux you have to install: Example:
xampp php5 on /opt/lampp then rename it to /opt/lampp5, then do the same with the php7 bin installer (or tar) and rename it to /opt/lampp7.
then copy this code into a new script.sh file, make it writable chmod +x script.sh, then run it $ ./script.sh or $ ./script.sh 5 start
here is the code example running fine on ubuntu 16.04, its just a simple script to make it work on this kind of problem, since on windows we can do it at the installation steps.



#!/bin/bash

LAMPP_VERSION=$1
LAMPP_ACTION=$2

LAMPP="/opt/lampp"
XAMPP=$LAMPP"/xampp"

function stopall {
sudo $XAMPP stopapache
sudo $XAMPP stopmysql
}

function startall {
sudo $XAMPP startapache
sudo $XAMPP startmysql
}

function stopmysql {
sudo $XAMPP stopmysql
}

function stopapache {
sudo $XAMPP stopapache
}

function startmysql {
sudo $XAMPP startmysql
}

function startapache {
sudo $XAMPP startapache
}

function checklampplink {

# check if exist a link and delete it
if [[ -L "$LAMPP" && -d "$LAMPP" ]]
then
echo "$LAMPP is a symlink to a directory: try DELETE!"
sudo rm -f $LAMPP
else
echo "NO $LAMPP LINK WAS FOUND!"
fi

# create a new link
echo "try to create LAMPP link ..."
cd /opt
ln -s "$LAMPP$LAMPP_VERSION" "lampp"

## check if is created
if [[ -L "$LAMPP" && -d "$LAMPP" ]];
then
echo $LAMPP "created!"
else
echo "LINK not created! exit 1"
exit 1
fi
}

function checkservices {

# check if services exists and try to stop property
PIDS_MYSQL=$(ps -C mysqld -C mysqld_safe -o pid=)
PIDS_APACHE=$(ps -C /opt/lampp/bin/ -o pid=)

if [ -n $PIDS_MYSQL ];
then
stopmysql
else
echo "NO MYSQL TO KILL"
fi
if [ -n "$PIDS_APACHE" ];
then
stopapache
else
echo "NO APACHE TO KILL"
fi

}

### begin ###



####
# get an action
if [ -z $LAMPP_ACTION ];
then
echo
echo "ACTION: ( start | stop | restart)?"
read LAMPP_ACTION
else
echo "ACTION SET TO: "$LAMPP_ACTION
fi
# if action is stop exit
if [ "$LAMPP_ACTION" == "stop" ];
then
stopall
exit 0
fi

####
# get a version
if [ -z $LAMPP_VERSION ];
then
echo
echo "VERSION: ( 5 | 7 )? "
read LAMPP_VERSION
else
echo "VERSION SET TO: " $LAMPP_VERSION
fi
if [[ "$LAMPP_VERSION" = "5" || "$LAMPP_VERSION" = "7" ]];
then
echo "GOOD version continue ..."
else
echo "Wrong version exit 1"
exit 1
fi

## if action is start or restart do the same
checkservices

# check folder link
checklampplink

echo

echo "Select an option to START:"
echo "1) ALL current installed services on xampp"
echo "2) Apache and Mysql - phpmyadmin"
echo
echo "Type enter to start option default ( 1 ) "
read USER_START
echo
echo "Starting services ..."
echo

if [ -z $USER_START ];
then
startapache
startmysql
else
if [ "$USER_START" = "1" ];
then
startall
else
startapache
startmysql
fi
fi

echo "Done";
exit 0


if this code have any syntax problem, sorry I just paste here.
good luck!







share|improve this answer












share|improve this answer



share|improve this answer










answered Jul 15 '16 at 5:31









rafaelphprafaelphp

1158




1158













  • github.com/rafaelphp/lampp_switcher

    – rafaelphp
    May 12 '17 at 13:25



















  • github.com/rafaelphp/lampp_switcher

    – rafaelphp
    May 12 '17 at 13:25

















github.com/rafaelphp/lampp_switcher

– rafaelphp
May 12 '17 at 13:25





github.com/rafaelphp/lampp_switcher

– rafaelphp
May 12 '17 at 13:25


















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f198876%2fhow-to-install-multiple-versions-of-xampp%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to send String Array data to Server using php in android

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

Is anime1.com a legal site for watching anime?