This guide shows you how to set up a LAMP server (Linux, Apache, MySQL and PHP) for developing PHP-based web applications on Ubuntu Linux with 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 building a PHP development environment. It’s open source and available on all major operating systems, including Windows, Linux, and macOS. The core components that work together to create XAMPP include Apache, MySQL, PHP, and Perl.
The XAMPP server is ideal for software development or prototyping as it is relatively easy to set up and does not require a lot of configuration. Note, however, that XAMPP is not recommended for use as a production server as it compromises some security issues to make setting up your development environment easier. 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 should download the XAMPP Debian package for Ubuntu Linux as described below.
First go to your Downloads directory with the cd command.
Run the following command to download XAMPP with wget, a command line tool for downloading packages from the Internet.
Note: You can replace the XAMPP version in the command above with the version of your choice if you want.
Since your current working directory is the / Downloads Folder wget will automatically save the installation program of the XAMPP application in this 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 with the chmod command.
sudo chmod 755 xampp-linux-x64-8.0.8-0-installer.run
If you run the XAMPP installer with the ls -l Command, you will get output similar to the following. As you can see, the installer now has “Run” permissions.
Issue the following command to start the XAMPP installer:
The start screen of the XAMPP installer should look similar to the following:
Click on that Next and follow the installation instructions of the wizard.
Click on that Finished Button to complete the installation.
As soon as the installation is complete, the system saves the XAMPP files in / opt / lampp Directory on your system. The websites or projects are in the / opt / lampp / htdocs Directory.
To start the XAMPP services like Apache, MySQL and ProFTPD just run the following command:
sudo /opt/lampp/lampp start
You can check the status of the XAMPP services by typing:
sudo /opt/lampp/lampp status
Also note that XAMPP comes with a graphical tool that makes it easy to 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, everything is likely working as expected.
To check that the Apache server is serving your web pages as expected, type http: // localhost in your web browser. The browser displays a page similar to the following. For your information, the Apache server runs on port 80 by default.
You can also access the MySQL database that comes with XAMPP by typing: http: // localhost / phpmyadmin Url in your browser.
Setting up a LAMP server in WSL
This guide showed you how to set up a XAMPP server that will be used when developing your PHP-based applications. For security reasons, you should never use XAMPP for production purposes.
For developers working on the Windows subsystem for Linux, you can also set up a LAMP server on WSL if necessary.
Do you want to start web development on the Windows Subsystem for Linux? Start by setting up a LAMP test environment.
About the author