TL;DR: How to Install XAMPP
This guide covers how to install XAMPP on both Windows and Mac and get your local development environment up and running in minutes.
1. Installation
- Download: Get the installer from the official Apache Friends website.
- Warnings: You may see a UAC (User Account Control) warning. This is normal; just avoid installing XAMPP into the
C:\Program Filesdirectory (the defaultC:\xamppis best). - Components: Keep the default selections (Apache, MySQL, PHP, and phpMyAdmin are the essentials).
2. Setting Up the Services
- Control Panel: Open the XAMPP Control Panel to start both Apache and MySQL — these are the two core services you need running for local PHP development.
- Start Services: Click the Start button next to Apache (the web server) and MySQL (the database). They will turn green once active.
- Firewall: If Windows asks for permission, click Allow Access for these services to run.
3. Testing the Server
- Localhost: Open your browser and type
http://localhost. If you see the XAMPP dashboard, it’s working. - Root Directory: All your website files must be saved in the
htdocsfolder (usually found atC:\xampp\htdocs).- The XAMPP htdocs folder is where all your project files must live — think of it as your local website’s public root directory.
- Running a File: If you save a file as
test.phpin the htdocs folder, you access it athttp://localhost/test.php.
This is how you run PHP on localhost — simply place your file in htdocs and access it via your browser.
Pro Tip: Apache Port 80 Conflict Fix
If Apache fails to start, it’s often because another program (like Skype or VMware) is using Port 80. You can change this in the Apache
httpd.conffile or close the conflicting app.
Why XAMPP Is the Best Local Development Environment for Beginners
XAMPP is a cross-platform solution and distribution of Apache which contains MySQL, Perl, PHP, and Python sectors. It is a conglomeration of LAMP, WAMP, and MAMP that aids in developing PHP web applications, including the phpMyAdmin module.
As an open-source distribution of Apache containing Perl, MariaDB, and PHP, XAMPP is a web server used to pre-test and pre-allocate resources for a project before deployment. While it is a cross-platform server, it is often noted to perform best with Windows.
Also Read:
How to Set Up Visual Studio Code for Web Development
How to Install XAMPP using Windows
The procedure for XAMPP requires some manual routing and copy-pasting. Follow these steps:
- Download: Get the latest Windows version of XAMPP from the Apache Friends website.
- Install XAMPP: Run the installer to install XAMPP on your computer.
- Launch: Open the XAMPP Control Panel once installation is complete.
- Start Modules: Click the Start buttons next to the Apache and MySQL modules.
- Access Directory: Click the Explorer button in the Control Panel to open the installation directory.
- Navigate to Root: Go to the htdocs folder, which is the default root directory for XAMPP web servers.
- Create Project: Create a new folder inside htdocs to serve as your project’s root directory.
- Add Files: Copy your project’s PHP files into this new folder.
- View Project: Open a web browser and enter localhost. Click the link for your project folder to access your work.
How to Install XAMPP using Mac/OSX
The process is similar to Windows, but involves a .dmg file that must be handled correctly.
- Download: Get the latest OSX/Mac version of XAMPP from the Apache Friends website.
- Install XAMPP: Open the .dmg (disk image) file and run the installer. Follow the OSX instructions to complete the setup.
- Launch: Open the XAMPP Control Panel.
- Start Modules: Click the Start buttons for both Apache and MySQL.
- Mount Disk: Click the Volumes button in the Control Panel and select Mount next to your XAMPP disk image.
- Access Directory: Click on Explorer in the Control Panel to open the installation directory.
- Navigate to Root: Locate the htdocs folder, the default web root directory.
- Create Project: Create a new folder in htdocs for your PHP project.
- Add Files: Copy your PHP files into that folder.
- View Project: Enter localhost in your web browser and select your project folder.
Why Use XAMPP?
XAMPP is popular because it handles every basic requirement of a development environment needed for PHP web development. It allows beginners and learners to start their PHP journey with relative ease and comfort. You can easily install xampp by following above instructions.