Installing XAMPP (Apache + MariaDB + PHP + Perl) on Linux
βš™οΈ

A guide to setting up Apache, MariaDB, PHP, and Perl on Linux

Installing XAMPP (Apache + MariaDB + PHP + Perl) on Linux

A guide to setting up Apache, MariaDB, PHP, and Perl on Linux

What is XAMPP?

XAMPP is the most popular PHP development environment. It's a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl. The XAMPP open source package has been set up to be incredibly easy to install and to use.

QUICK CHECKLIST
  1. Download XAMPP from official website
  2. Set file permissions to executable
  3. Run installer with sudo privileges
  4. Verify installation in /opt/lampp
  5. Start XAMPP (GUI or CLI)
  6. Set project folder permissions
  7. Test locally at http://127.0.0.1
  8. Troubleshoot if needed

1.) Download

πŸ“₯ Download XAMPP from the official website

XAMPP Download

2.) Install

Step 2.1: Change File Permissions

Make the installer executable:

chmod 755 xampp-linux-*-installer.run

Step 2.2: Run the Installer

Execute with sudo privileges:

sudo ./xampp-linux-*-installer.run

⚠️ Root Privileges Required

Root privileges are needed to install XAMPP. If you forgot to use sudo, run: sudo !!

Installation Step

3.) Directory Structure

XAMPP will be installed in /opt/lampp. This is where you'll add your projects:

/opt/lampp/htdocs/
β”œβ”€β”€ project1/
β”‚   β”œβ”€β”€ index.html
β”‚   └── contact.php
β”œβ”€β”€ project2/
β”‚   β”œβ”€β”€ index.html
β”‚   └── contact.php
└── project3/
    └── ...
XAMPP GUI XAMPP GUI XAMPP GUI

πŸ’‘ Tip: Organization

Keep each project in its own folder to avoid conflicts and make organization easier in the future.


4.) GUI vs CLI

Graphical User Interface (GUI)

The easiest way to manage XAMPP is through the GUI. Launch it and you'll see all the options:

XAMPP GUI XAMPP GUI

Command Line Interface (CLI)

You can also manage XAMPP services via the command line:

sudo /opt/lampp/xampp start
sudo /opt/lampp/xampp stop
sudo /opt/lampp/xampp restart
XAMPP CLI

5.) Activate PHP & Test Locally

Activation

Once XAMPP is running, you can test your PHP projects locally by visiting:

http://127.0.0.1/project-name/

6.) File Permissions

Make sure Apache can read and execute your project files:

chmod -R 755 /opt/lampp/htdocs/your-project
File Permissions

πŸ’‘ Remember: Permissions Matter

Always ensure proper file permissions so Apache can access and execute your files correctly. This is crucial for your projects to work.

Activation

7.) Troubleshooting

Port 80 Already in Use

If XAMPP won't start, port 80 might already be in use by another service. Check which process is using it:

sudo netstat -tulpn | grep :80
Port Check

⚠️ Common Culprits

Your code editor's live server might still be running. Stop it first before starting Apache. Other services like nginx could also be using port 80.

Stop Conflicting Services

sudo systemctl stop apache2
sudo systemctl stop nginx

Then restart XAMPP and try again.


Success

And Hopefully, Congratulations! πŸ’

You are now running your own AMP server! You can use this to test back-end features like email, databases, and more locally before deploying to production. This is an essential tool for web development.

Top