This guide will show you how to configure a LAMP server (Linux, Apache, MySQL and PHP) to develop PHP based web applications on Ubuntu Linux using XAMPP.
You can use the XAMPP stack to develop PHP applications powered by frameworks like WordPress, Joomla, Drupal, PrestaShop, etc.
What is XAMPP?
XAMPP is one of the most popular LAMP stacks for setting up a PHP development environment. It is open source and available on all major operating systems including Windows, Linux, and macOS. The basic components that work together to create XAMPP include Apache, MySQL, PHP, and Perl.
The XAMPP server is ideal for software development or prototyping because it is relatively easy to install and does not require a lot of configuration. However, note that XAMPP is not recommended for use as a production server because it compromises some security issues to make it easier to set up your development environment. For example:
Anyone can easily access the MariaDB daemon over the network.
The default database administrator (root) does not have a password.
Download XAMPP for Linux
To get started, you need to download the Debian XAMPP package for Ubuntu Linux as shown below.
First, go to your downloads directory using the cd command.
Run the following command to download XAMPP using wget, a command line tool for downloading packages from the Internet.
To note: You can replace the XAMPP version in the above command with the version you want if you want.
Since your current working directory is the / Downloads folder, wget will automatically save the XAMPP application installer to that directory.
How to install XAMPP on Ubuntu
Before you can install the XAMPP application, you must change the permissions of the installer to make it executable using the chmod command.
sudo chmod 755 xampp-linux-x64-8.0.8-0-installer.run
If you list the XAMPP installer using the ls -l command, you will get output similar to the one below. As you can see, the installer now has “run” permissions.
Run the following command to start the XAMPP installer:
The initial screen of the XAMPP installer should look like the one below:
Click on the following and follow the wizard installation instructions.
Click on the Finish button to complete the installation.
Once the installation is complete, the system will store the XAMPP files in the / opt / lamp directory on your system. Web pages or projects will be placed in the / opt / lampp / htdocs phone book.
To start XAMPP services, such as Apache, MySQL, and ProFTPD, simply run the following command:
sudo /opt/lampp/lampp start
You can check the status of XAMPP services by typing:
sudo /opt/lampp/lampp status
Also note that XAMPP comes with a graphical tool that you can use to easily manage your services. You can start the XAMPP GUI tool with the following commands:
The following XAMPP window will open.
Check if everything works
If you can start the services without any problems, then everything is probably working as expected.
To check if the Apache server is serving your web pages as expected, type http: // localhost in your internet browser. The browser will display a page that looks like the one below. For your information, the Apache server works by default on port 80.
You can also access the MySQL database supplied with XAMPP by typing the http: // localhost / phpmyadmin URL in your browser.
Configuring a LAMP server in WSL
This guide has shown you how to configure an XAMPP server to use when developing your PHP based applications. For security reasons, you should never use XAMPP for production purposes.
For developers who are working on the Windows Subsystem for Linux, you can also configure a LAMP server on WSL if you want.
Want to get started in web development on the Windows Subsystem for Linux? Start by setting up a LAMP test environment.
About the Author