Launch Xampp from Linux Command Line -- The Easy Way

Quick and easy ways to Launch XAMPP from the command line with aliases.

Start & Stop -- The Easy Way!

You've installed XAMPP for Linux! Congratulations! Now that it's installed, how do you get it running? ApacheFriends has you covered for the basics, of course, but their methods make use of the command line, and aren't exactly efficient in terms of keystrokes.

If all you need to do is get services (Apache, MySQL, ProFTPD) started or stopped, ApacheFriends suggests you use the following:

$ sudo /opt/lampp/lampp start
//OR, AS THE CASE MAY BE 
$ sudo /opt/lampp/lampp stop

This is fine and all, but it requires a little finger work. You could, of course, create aliases for both of these commands in your .bashrc that would allow you to get up and running, or stop, with far fewer key strokes: i.e., 'letsgo' to start services, and 'stopit' to stop them. I keep my aliases in a .bash_aliases file in my user directory. If you don't have one, you can add one easily--the file name should already be referenced as an include in your .bashrc (again, a file you should find in your user directory--i.e., /home/username ):

//CD W/O PATH TO GET TO YOUR USER DIRECTORY (IF NOT ALREADY THERE)  
$ cd
//CREATE OR EDIT THE .bash_aliases FILE WITH NANO  
$ sudo nano .bash_aliases
//ADD THE FOLLOWING LINES TO THE FILE
alias letsgo='sudo /opt/lampp/lampp start'
alias stopit='sudo /opt/lampp/lampp stop'
//ctl-o TO SAVE, ctl-x TO QUIT NANO

//ONCE OUT OF NANO, RELOAD THE .bashrc FILE
$ source .bashrc

With the aliases in your bash, you should now be able to start and stop XAMPP services with one word:

start and stop xampp services on the command line
Success! Is it a tremendous game-changer? Maybe not... but, if you're constantly on the command-line, your carpal bones may thank you at the end of the day.

XAMPP Manager - The Easy Way

XAMPP manager
The XAMPP Manager can be a useful tool for accessing error logs quickly; this is particularly helpful if you find yourself mucking around with Apache, PHP or Database settings with any frequency.

Sometimes it's handy to actually get the XAMPP manager up and running (the graphical interface for managing services). When it comes to this, again, you've got a few options. The way ApacheFriends suggests you do it, though, is to hit the command-line and cd your way to the XAMPP install directory--then execute the manager. That should look like this:

$ cd /opt/lampp
$ sudo ./manager-linux-x64.run

Once again, there are much easier ways to do this. Much like before, we could go into our .bash_aliases file and create a one word alias to find the correct directory and then launch the manager for us. Let's use 'xampp' for our alias:

//CD W/O PATH TO GET TO YOUR USER DIRECTORY (IF NOT ALREADY THERE)  
$ cd
//CREATE OR EDIT THE .bash_aliases FILE WITH NANO  
$ sudo nano .bash_aliases
//ADD THE FOLLOWING LINES TO THE FILE
alias xampp='(cd /opt/lampp && sudo ./manager-linux-x64.run)'
//ctl-o TO SAVE, ctl-x TO QUIT NANO

//ONCE OUT OF NANO, RELOAD THE .bashrc FILE
$ source .bashrc

Now you should be able to just type 'xampp' into your terminal and launch the manager. Since the command executes with, sudo, however, you will have to enter your user password (... you would have to either way, actually):

using an alias to lauch the xampp manager
Success again!

You could, of course, also create a launcher for the XAMPP manager (... or go and install Windoze or drop a couple thou on a MacBook), but what's the fun in that? There's a good reason you're installing XAMPP on Linux--right? Still, if you just have to have a launcher, it can be done. On Xubuntu (and Lubuntu, I believe--although, I haven't tried) it's a pretty straight-forward task. Add a new Launcher to your Panel and set it up like so:

setting up a launcher
You're basically doing the same thing in the launcher as with the bash alias: declare a working directory and execute the .run file.

On straight plain old Ubuntu I don't recall how I setup the launcher (not too much different... I think...). My Ubuntu machine is out of commission until Fall '21. It's warm enough in New Mexico now that I can't use the MacPro until the weather cools down again: it generates way too much heat in my office. In the interim, I'll have to get a Ubuntu VM up on my ThinkPad. I like Lubuntu better for VM instances at the moment, though.