XAMPP is a free and open-source software package that provides an easy way to set up and run a local web server environment on various operating systems, including Ubuntu.
The acronym stands for Cross-Platform (X), Apache (A), MySQL (M), PHP (P), and Perl (P), representing its core components. XAMPP is especially useful for web developers as it includes all the essential tools required to develop, test, and debug web applications in a local environment before deploying them to a live server.
Development
On Ubuntu, XAMPP simplifies the process of managing a web server by packaging Apache, the popular HTTP server, alongside MySQL (or MariaDB in recent versions) for database management and PHP/Perl for server-side scripting. These components are configured to work together seamlessly, eliminating the need for manual configuration and reducing potential compatibility issues. Once installed, XAMPP can be started and managed from the terminal or a graphical control panel, providing control over the running services and allowing developers to enable or disable Apache, MySQL, and ProFTPD as required.
When developing websites, place project files in the /opt/lampp/htdocs
directory, as this is the root directory for Apache in XAMPP. You may need root privileges to add or edit files in this location. Adjusting permissions can be done with sudo chown -R your-username /opt/lampp/htdocs
to allow easier file management without elevated privileges.
Important Commands
How to start XAMPP in Ubuntu
To start XAMPP run the following and the command will return a list of running services:
sudo /opt/lampp/lampp start
How to stop XAMPP in Ubuntu
To stop XAMPP run the command below and it will return a list of the stopped services.
sudo /opt/lampp/lampp stop
How to restart XAMPP in Ubuntu
To restart XAMPP run the command below and it will stop and restart the running services.
sudo /opt/lampp/lampp restart
Apache, MySQL and FTP
You can also stop/start/restart individual services by appending “apache”, “mysql” or “ftp” to the end.
Starting
start
– Start XAMPP (Apache, MySQL and eventually others)
startapache
– Start only Apache
startmysql
– Start only MySQL
startftp
– Start only ProFTPD
Stopping
stop
– Stop XAMPP (Apache, MySQL and eventually others)
stopapache
– Stop only Apache
stopmysql
– Stop only MySQL
stopftp
– Stop only ProFTPD
Restart
reload
– Reload XAMPP (Apache, MySQL and eventually others)
reloadapache
– Reload only Apache
reloadmysql
– Reload only MySQL
reloadftp
– Reload only ProFTPD
restart
– Stop and start XAMPP
SSL & Security
security
– Check XAMPP’s security
enablessl
– Enable SSL support for Apache
disablessl
– Disable SSL support for Apache
Config
backup
– Make backup file of your XAMPP config, log and data files
oci8
– Enable the oci8 extenssion
GUI Panel
panel
– Starts graphical XAMPP control panel
Uninstall
Finally, to uninstall XAMPP, run sudo /opt/lampp/uninstall
and then manually remove the /opt/lampp
directory if required. This outline should allow you to set up and use XAMPP on Ubuntu effectively for local development purposes.