Localhost is a local web server for testing and development. In this tutorial, we learn to install XAMPP and setup localhost.
What Will We Learn
- Install XAMPP
- Setup a local web server or localhost
- Learn to view HTML file in localhost
What is XAMPP?
XAMPP is a free and open source cross-platform web server. It is simple and easy to setup. XAMPP stands for Cross-Platform (X), Apache (A), MariaDB (M), PHP (P), Pearl (P). After installing XAMPP, you have a local web server with database.
Download XAMPP
Go to Apache Friends, and download XAMPP.
Choose a PHP version based on your need. If you do not have specific requirement for PHP version, just choose the latest one which is 7.2.1 / PHP 7.2.1.
Install XAMPP
After downloading XAMPP, double click to launch the installer.
Click on Next and proceed with the installation.
In this section, you can choose what components you need. To setup localhost, we only need to install Apache and PHP. However, I would recommend installing Apache, PHP, MySQL and phpMyAdmin for standard web development environment. MySQL (MariaDB) and phpMyAdmin are used to setup database. By installing database, we can setup popular CMS like WordPress.
Select a folder to install XAMPP, then continue with the installation.
Uncheck it then continue with the installation. The installation starts after this step. Wait for a few minutes for the installation to be completed.
At this step, we have completed the installation. Click on Finish to close the installation window.
After completing the installation, you may see this security alert from Windows Firewall. Click on Allow Access to allow XAMPP to run on your computer.
Launch XAMPP
After the installation, it is time to launch XAMPP.
When you launch XAMPP for the first time, you have the option to choose your language.
Setup Localhost
Click on Start for Apache module. Now localhost is ready to be used. You can access your localhost by opening your browser and enter http://localhost/
into your browser.
If you able to see this page, it means you have successfully setup localhost environment in your computer.
To load your file from localhost, you need to place your file into htdocs folder inside XAMPP. If you install XAMPP in the default directory, the path should be C:\xampp\htdocs
For learning purpose, you can download an index.html file from here. Place the file in your htdocs folder, then open it with this URL, http://localhost/index.html
If you see the image above, you have successfully viewed the html file in localhost. That’s all for this tutorial, hope you enjoyed it.
It was a nice intro to Xamp. I liked the flow in the intro tutorial… Thanks