How to install and set up XAMPP on Windows
  John   |     23 May 2023

How to install and set up XAMPP on Windows

XAMPP is a free open-source web server solution stack package that comprises the Apache HTTP Server, MySQL(or MariaDB) database, and interpreters for scripts written in the PHP and Perl programming languages.

Its name is an acronym for cross-platform (X), Apache, MySQL (or MariaDB), PHP, and Perl (P).

The term "cross-platform" typically refers to its ability to run on different operating systems including Windows, Linux, and macOS.

XAMPP components

  • Apache: It is a free and open-source web server software that is the most widely used worldwide for the delivery of web content. It is developed and maintained by a community of developers in the Apache Software Foundation.
  • MySQL/MariaDB: It is a free and open-source relational database management system (RDBMS). It is a very popular and most widely used RDBMS for the development of web-based software applications. XAMPP used to have MySQL, but current versions have replaced it with MariaDB.
  • PHP: This is a server-side programming language that allows developers to create dynamic websites and web applications. Its name is an acronym of Hypertext Processor. PHP is an interpreted language with its interpreter written in the C language. PHP supports a range of database management systems and its interpreter can be installed on different platforms.
  • Perl: Like PHP, Perl allows developers to create dynamic web applications. It is a server-side scripting language used in system administration, web development, and network programming. It supports HTML, XML, and other markup languages.

While each of these components can be installed individually, this can be quite a task, taking a lot of time and effort. XAMPP was built to get rid of these hassles and make setting up and managing all these components as simple as possible. There are other similar applications that do the same thing but XAMPP is the most popular.

In addition to the 4 core components described above, XAMPP also contains some other helpful tools depending on your operating systems such as the phpMyAdmin database management tool, FileZilla FTP server, Mercury mail server, Webalizer web analytics software, and Tomcat JSP server.

PHP code, being a server-side language can only run on a web server, unlike Javascript and HTML which run directly on the web browser. You can either host your PHP code on an online server or establish a local server to run the code on your PC.

XAMPP allows you to build and run PHP-based websites and applications offline on a local web server on your PC. It is a simple and lightweight solution that is easy to install and use.

XAMPP installation on Windows

The steps below show how to install XAMPP on Windows 10, which is also very similar to other Windows versions.

Step 1: Download XAMPP setup from the Official XAMPP download page on the Apache Friends website.

Click on the Download button on the latest version under the "XAMPP for Windows" section. However, if you have special version requirements for PHP then you should download the relevant XAMPP version in your case.

Downloading XAMPP setup for Windows

Step 2: Now open where the file was downloaded and run it by double-clicking on it.

Running the XAMPP setup on Windows

Step 3: Click on the "Next" button to start the setup wizard.

Starting XAMPP installation on Windows

Step 4: XAMPP offers a variety of components to be installed as a software bundle. The setup wizard provides an option to exclude individual components from the installation. In most cases, you will need most of these components for a full local test server. It is recommended you leave all of them ticked as default. After you are done making your choice, click on the "Next" button to continue.

Selecting XAMPP components to install

Step 5: In the next step, you are presented with the default location where XAMPP will be installed. If for some reason you want it installed in a different location, you can change it by writing the new path in the "Select a folder" textbox or by clicking on the button next to it and selecting the location from your PC storage. Once you are comfortable with the chosen location, click on the "Next" button to continue.

Selecting XAMPP installation folder

Step 6: Select your preferred language then click on the "Next" button.

Selecting XAMPP language

Step 7: Click on the "Next" button.

Bitnami for XAMPP

Step 8: The setup is now ready to begin installing XAMPP on your computer. Click on the "Next" button to start the installation.

The setup wizard will unpack and install all the selected XAMPP components to the chosen installation location. This process can take up to several minutes. You will be able to estimate how far it is gone by looking at the progress bar. Wait until it is over.

XAMPP installation process

Step 9: You will be notified once the installation process is complete. Click on the "Finish" button to exit the setup wizard.

XAMPP installation complete

The XAMPP control panel will launch/start automatically. Click on the "Start" buttons under the "Actions" column to run/start the respective XAMPP modules (in most cases that will be Apache and MySQL).

XAMPP control panel

After starting a service for the first time, you will be prompted to allow the Apache HTTP server to communicate with your networks. Click on the "Allow access" button to allow it.

Allowing XAMPP access to the network

You will be able to see which services are running as their names will be highlighted in green under the module column. Each of their buttons under the Actions column will also have changed to "Stop". To stop a service, just click on the respective stop button.

In addition to the start and stop buttons, there are a couple of other buttons with varying functions.

  • Config: This allows you to do configurations on XAMPP as well as its individual components.
  • Netstat: This allows you to see a list of all the running processes on your local computer.
  • Shell: This opens a UNIX shell.
  • Explorer: This opens the XAMPP folder in Windows Explorer.
  • Services: This shows a list of all the active services in the background.
  • Help: This provides access to user forums.
  • Quit: This closes and exits the XAMPP Control Panel.

You can test whether XAMPP is running properly by writing "localhost" in the web browser address bar and hitting enter. It should load the dashboard of your XAMPP’s local host as shown below.

XAMPP local host dashboard

To open the phpMyAdmin database management tool, write "localhost/phpmyadmin" in the browser address bar and hit enter. It looks as in the image below. You can use it to easily create and manage MySQL databases for your web projects.

XAMPP phpMyAdmin interface

If you are very new to PHP and XAMPP you may be wondering; John, now that I know how to install, set up, and start XAMPP, how then do I run my PHP codes?

Worry no more. You will be required to store your PHP files inside the "htdocs" folder of the XAMPP installation. It is by default located within "C:\xampp\htdocs". This location can only be different if you changed the default XAMPP directory during installation. In such a case then you should open the 'htdocs' folder within that directory.

But since over time you will create different web projects, it is not advisable to place them directly all together in one folder as they will mix and create confusion. Create a separate folder for each web project inside the 'htdocs' folder.

To run a PHP code with XAMPP and display the result on your browser, type "localhost/" in the address bar followed by the relative path of the file to the htdocs folder.

For instance, if you have a file located at "C:\xampp\htdocs\mysite\samplepage.php", you will write "localhost/mysite/samplepage.php" on the web browser address bar and hit enter and your code will be executed and the result displayed.

The home page of a website on a web server is named as "index" eg index.php, index.html, etc. So for the same example given above, the homepage for 'mysite' will have a path "C:\xampp\htdocs\mysite\index.php". When accessing the home page, you don't have to write the full path on the browser address bar. You will write it just as "localhost/mysite/" and on hitting enter the "index.php" file will be executed automatically.

That's it!

With this information, you can now comfortably download and install XAMPP on your Windows PC, start its services, manage MySQL databases and run your PHP codes. It's my hope you enjoyed the tutorial and found it helpful.