How to set up a PHP dev env in GNU/Linux with XAMPP

Overview

The purpose of this shot is to show you a step-by-step guide on how to get started with XAMPP in your GNU/Linux OSOperating System.


In this shot, we will use Debian GNU/Linux, but the process is almost identical with other distros/distributions.

Download and installation

XAMPP is a cross-platform LAMPLinux, Apache, MySQL, PHP stack solution, meaning that you can use it on all operating systems.

Download the Linux installer here.

Then, make it an executable:

  • Right-click on the file and go to Properties.

  • Under the Permissions tab, mark Allow executing file as program (see image below).

Via CLI (Command Line Interface)

Via command line (CLI):


chmod 755 xampp-linux-*-installer.run

Next, you could just double-click the installer to start the installation process. Unfortunately, XAMPP requires root privilege.

How to acquire root privileges

Move to the directory where you have downloaded the installer and right-click to open the Terminal window. From the CLI, run this command:


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

You’ll be prompted for your password. Type it and hit the Enter button to launch the Wizard. You should be able to install XAMPP following the Wizard.

Congratulations. You’ve successfully installed XAMPP in your system. Let’s see how to start/stop it.

Turn the server on/off

Now that you’ve configured a server in your local machine, you may need to start or stop from time to time.

The XAMPP you’ve just installed is a CLI program, so you’ll need the Terminal to use it.

Turn the server on

You need to type the command below from the Terminal.


sudo /opt/lampp/lampp start

Turn the server off


sudo /opt/lampp/lampp stop

If you have Apache installed locally, you may need to stop it before starting XAMPP sudo service apache2 stop.


If you find that typing /opt/lampp/ is too long, you can add it to your environment variable.

Conclusion

In this shot, we learned how to install a local PHP development environment and how to start and stop the server.

Free Resources

Attributions:
  1. undefined by undefined