How to Create a Linux Launcher for the XAMPP Control Panel

XAMPP is a popular open-source web server stack solution distributed by Apache Friends. It aids in integrating the MariaDB database, Apache HTTP Server, and Perl interpreters with a PHP script interpreter. This integration facilitates developers in setting up local servers to test and deploy web content. Installing this package provides access to a single control panel. However, it often neglects to create a launcher for it.

You can create a .desktop file to provide instant access to the XAMPP control panel. Irrespective of whether you use Unity, GNOME, KDE, LXDE, Xfce4 or another desktop environment, you more than likely have access to a directory located at ~/.local/share/applications for installation of .desktop files. This covers the major graphical Ubuntu distributions. If your distribution places launchers somewhere else, simply modify these directions to point it at the right place.

Method 1: Create a .desktop File for the XAMPP Control Panel

Open up a terminal by holding down CTRL, ALT and T, and then type gedit ~/.local/share/applications/xampp-control-panel.desktop to create a new file. If you’re using Lubuntu you’ll need to replace gedit with leafpad, and Xubuntu users will want to use mousepad instead. You could also use vi or nano regardless of which Ubuntu or other Linux configuration you’re dealing with.

When you’re in your chosen text editor, put the following code into the new file:

[Desktop Entry]

Comment=Start or Stop XAMPP

Name=XAMPP Control Panel

Exec=gksu “python /opt/lampp/share/xampp-control-panel/xampp-control-panel.py”

Icon[en_US]=/usr/share/icons/Humanity/devices/24/network-wired.svg

Encoding=UTF-8

Terminal=false

Name[en_US]=XAMPP Control Panel

Comment[en_US]=Start or Stop XAMPP

Type=Application

Icon=/opt/lampp/htdocs/favicon.ico

Hold down CTRL and hit S to save the file, or save it from the drop-down file menu. Close the text editor, but keep in mind that you might have to go back to it later. Now issue the command sudo chmod +x  ~/.local/share/applications/xampp-control-panel.desktop to make it executable.

Head over to Dash and try launching it. If you’re not using Unity, check it with whichever application launcher or desktop icon system you’re using. More than likely, you’ll be asked for your password when you start it.

Method 2: Ironing Out Wrinkles in XAMPP

If everything has worked, you don’t need to proceed. Sometimes, nothing may happen after creating a file like this. If that’s the case, try running gksu python /opt/lampp/share/xampp-control-panel/xampp-control-panel.py from the CLI and check for any error messages. You might receive a message that reads something like “Error importing pygtk2 and pygtk2-libglade,” which can be fixed by installing python-libglade dependencies. You can install them with the sudo apt-get install python-glade2 command.

You could also try replacing the line ‘Exec’ in the control panel with ‘Exec=sudo -i python /opt/lampp/share/xampp-control-panel/xampp-control-panel.py. This might help execute the command. Bear in mind that it’s not necessary to use these icons either. The ‘Icon=’ lines can be pointed to any file of your choice. There’s also an option to use a free icon set from the internet, allowing us to display the icons however we prefer. For instance, consider this example, which includes a dummy mouse cursor, derived from the famous Flatastic icon set. This set is free for non-commercial use.

It’s even possible to point to two separate additional icons. While en_US was used in the example, this could be replaced to match any local language. It might not even be necessary in the coding.

Should you ever want to remove XAMPP, you’ll have to remove the icon as well with these commands:

cd ~/.local/share/applications/

sudo rm xampp-control-panel.desktop

ABOUT THE AUTHOR

Kevin Arrows


Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.