3 mins read

How to install Xampp on Linux

In this tutorial we are going to learn Installing latest version of Xampp on Linux , setting Linux htdocs folder permissions issue, How to add a Linux environment variable for PHP, Installing Composer “A Dependency Manager for PHP”.

XAMPP is a completely free, easy to install Apache distribution containing MySQL / MariaDB, PHP, and Perl. The XAMPP open source package has been set up to be incredibly easy to install and to use. Best part is Xampp is cross-platform tool available for Windows , Mac and Linux.

We are going to break this tutorial in several parts to make this tutorial easy to use :

Part 1 : Xampp Installation

visit https://www.apachefriends.org to download latest version of xampp. like I have downloaded xampp in /home/sanjay/download directory

Now Open Terminal / Konsole and using cd command move
to /home/sanjay/download

Now run command
sudo chmod 755 xampp-linux-*-installer.run
sudo ./xampp-linux-*-installer.run

Part 2 :  Fixing Linux htdocs folder permissions issue

Now Open Terminal / Konsole and run commands given below

sudo chown -R daemon:daemon /opt/lampp/htdoc
sudo chmod 777 -R /opt/lampp/htdocs

Part 3 : Setting PHP environment variable

Method 1 (use when method 2 fails) :
sudo nano /etc/environment
add
:/opt/lampp/bin/php
in last and save and run
sudo ln -s /opt/lampp/bin/php /usr/local/bin/php

Method 2 (Recommended ) :

For PHP
export PATH=$PATH:/opt/lampp/bin/php
sudo ln -s /opt/lampp/bin/php /usr/local/bin/php

For MySQL

export PATH=$PATH:/opt/lampp/bin/mysql
sudo ln -s /opt/lampp/bin/mysql /usr/local/bin/mysql

Part 4 : Installing Composer

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

Part 5: Xampp Control Panel GUI

sudo nano /usr/share/applications/firefox-developer.desktop
and paste

[Desktop Entry]
Encoding=UTF-8
Exec=opt/lampp/manager-linux-x64.run
Icon=opt/lampp/htdocs/favicon.ico
Type=Application
Terminal=false
Comment=XAMPP Control Panel
Name=XAMPP Control Panel
GenericName=XAMPP Control Panel
StartupNotify=false
Category=Development;System;

then press CTRL+X and type y and Press Enter.

Xampp Common commands

sudo /opt/lampp/lampp start (Will Start Xammp)
sudo /opt/lampp/lampp stop (will Stop Xampp)
sudo /opt/lampp/lampp restart (will restart Xampp)

Xampp configurable files

The main XAMPP configuration files are located as follows:

Apache configuration file: /opt/lampp/etc/httpd.conf, /opt/lampp/etc/extra/httpd-xampp.conf
PHP configuration file: /opt/lampp/etc/php.ini
MySQL configuration file: /opt/lampp/etc/my.cnf
ProFTPD configuration file: /opt/lampp/etc/proftpd.conf

If you still facing any problem then please comment your problem , I will try to fix those problems.

5 1 vote
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

2 Comments
Oldest
Newest Most Voted
Sassank Sethi

You save my whole the day, thanks ….