Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 at 23:33

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 this article 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
    
useful link! thank you... :) – abdgstywn Oct 12 '12 at 8:06
    
you are welcome :) – devav2 Oct 12 '12 at 8:51
    
is that way we need you put some code as example on the aswers! ALL links are DOWN! – rafaelphp Jul 14 at 23:33

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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