How To Start XAMPP Automatically In Linux Mint

In an earlier post, we had shown how to install XAMPP on Mint.

Once installed, XAMPP needs to be started manually after every PC restart with the long command sudo /opt/lampp/lampp start.

But there is a way to avoid this so that XAMPP can be started automatically every time system is restarted. To do this, we can simply add the command that is entered every time to start XAMPP in an initialization script which makes sure that it is run every time system is restarted.

Here is how :

1. Navigate to the following path : /etc and locate the file rc.local

2. Right click it and select Open as administrator ( or open any text editor  like vi with root privileges) which will bring up the below window for it to be edited using gedit :

3. Add the line /opt/lampp/lampp start as shown and save the file.

4. Restart Mint and once logged on, open a browser and type http://localhost which should now show the XAMPP home page directly.

There you go, no more typing of the long command to get XAMPP working every time Mint is rebooted.

Enjoy 🙂

  1. Vadim Volos says:

    openSUSE = after.local

    Line
    “exit 0”
    add too?

  2. admin says:

    Hi poorJudgement,

    You can try checking for the command flag (after XAMPP is executed successfully, try a echo $? and see if 0 is returned then it is successful else not by using if [ $? -eq 0 ], if yes then, put some conditions else something else.

    Take a look at this script for example:
    https://www.ihaveapc.com/2011/04/a-simple-linux-shell-script-to-test-internet-connectivity/

    Cheers.

  3. poorJudgment says:

    Great! I put this a bash script that runs from a launcher on the desktop.

    Is there a way to detect if XAMPP is runnng already and create a control structure in a bash script that will simply toggle XAMPP on (if it’s off) and off (if it’s on)?

    The need has to do with me messing around with various things on the same machine from time to time and XAMPP not playing well with some of the other things. So, if I could toggle in and out – that would rock.

  4. iqbalhafidh says:

    Thats great.. 🙂
    to : jeff musgrave, rc.local is a file not a folder

    Thanks for your help, but i have to try it first
    Lets see

  5. jeff musgrave says:

    I have a lot of rc1.d, rc2.d, rc3.d, rc4.d, rc5.d, rc6.d, rcS.d
    but I don’t have an rc.local
    What do I do?
    I am running mint 9 lts

    • admin says:

      Jeff,

      Open Terminal and type in : sudo gedit /etc/rc.local.
      Enter your root or admin password when prompted.

      This will open the file rc.local for editing.

      Hope this helps.

  6. Ryan says:

    Thanks for this tip, I was looking for the solution to this problem and this was it!