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 helps you join the MariaDB database, Apache HTTP Server and Perl intepreters with a PHP script interpreter together. This makes it easy for developers to create local servers to test and deploy Web content. Installing this package gives you access to a single control panel, but 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 fo ther 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, or if you’re not using Unity check it with whatever applications launch 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 worked, then you don’t need to proceed. Sometimes nothing will happen after creating a file like this. If that’s the case, then try running gksu python /opt/lampp/share/xampp-control-panel/xampp-control-panel.py from the CLI and check any error messages. You might get a message that reads something like “Error importing pygtk2 and pygtk2-libglade,”  which can be fixed by installing python-libglade dependencies. Install them with the sudo apt-get install python-glade2 command.

You could also try replacing the control panel Exec line with Exec=sudo -i python /opt/lampp/share/xampp-control-panel/xampp-control-panel.py and see if it then executes. Keep in mind that you don’t have to use these icons either. You can point the Icon= lines to whatever files you’d like. Using a free icon set from the Internet, we could set them to display however we’d like. Consider this example, which includes a dummy mouse cursor from the famous Flatastic, which is free for non-commercial usage.

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.
Back to top button