How to Install XAMPP: Setup Localhost Server in Minutes
XAMPP is a free software package that installs Apache, MySQL, PHP, and Perl on your computer. It allows you to create a local web server for testing websites and web applications offline.
How to Install XAMPP: Setup Localhost Server in Minutes
Want to turn your computer into a powerful web server in just a few minutes? XAMPP is the answer. It is a free, open-source software package that installs everything you need to run a local web server: Apache (web server), MySQL (database), PHP (server-side scripting), and Perl. Whether you are learning web development, testing WordPress themes, or building PHP applications, XAMPP gives you a complete development environment right on your computer.
The best part? You don't need an internet connection to test your websites. Everything runs locally on your machine. To understand this tutorial properly, it is helpful to be familiar with web servers and PHP basics.
✓ Downloading XAMPP from the official website
✓ Installing XAMPP on Windows / Mac / Linux
✓ Selecting required components (Apache, MySQL, PHP)
✓ Starting Apache and MySQL services
✓ Verifying installation with localhost
✓ Troubleshooting common installation issues
What Is XAMPP
XAMPP is a completely free, easy-to-install Apache distribution containing MariaDB, PHP, and Perl. The name XAMPP is an acronym:
- X: Cross-platform (works on Windows, Mac, Linux)
- A: Apache (web server)
- M: MariaDB / MySQL (database)
- P: PHP (server-side scripting language)
- P: Perl (programming language)
XAMPP is designed to be a complete web server solution for developers. It saves you from the hassle of installing and configuring Apache, MySQL, and PHP separately. With XAMPP, you can start coding in minutes.
Why You Need XAMPP
- Free and Open Source: No cost to download, use, or distribute.
- Cross-Platform: Works on Windows, macOS, and Linux.
- Complete Package: Includes everything you need for web development.
- Beginner Friendly: Easy installation with a graphical control panel.
- No Internet Required: Test websites offline on your own computer.
- Large Community: Millions of developers use XAMPP worldwide.
Step 1: Download XAMPP
Start by opening your browser and searching for XAMPP. Make sure you click on the official Apache Friends website to download the safe and latest version.
1. Open your web browser (Chrome, Firefox, Edge)
2. Go to: https://www.apachefriends.org/
3. Once you are on the site, choose your operating system:
- Windows: Click the "XAMPP for Windows" button
- macOS: Click the "XAMPP for macOS" button
- Linux: Click the "XAMPP for Linux" button
4. Begin the download. It may take a moment, so just wait until it finishes.
5. The file size is approximately 150 MB.
Step 2: Install XAMPP on Windows
After the download is complete, open the file to start the installation. If a security warning appears, simply click Yes and continue.
1. Double-click the downloaded .exe installer file
2. Click "Yes" if Windows asks for permission
3. The setup wizard will guide you through the process
4. Click "Next" on the welcome screen
5. Select components to install:
✓ Apache (required)
✓ MySQL (required)
✓ PHP (required)
✓ phpMyAdmin (recommended)
✓ (Other components optional)
6. Choose installation location (default: C:\xampp)
7. Click "Next" and then "Install"
8. The installation will begin. This might take a few minutes.
9. Once complete, click "Finish" to launch XAMPP Control Panel
Step 3: Install XAMPP on macOS
1. Open the downloaded .dmg file
2. Drag the XAMPP folder to your Applications folder
3. Open XAMPP from Applications
4. If macOS blocks the app, go to:
System Preferences → Security & Privacy → Click "Open Anyway"
5. The XAMPP Manager window will open automatically
Step 4: Install XAMPP on Linux
1. Open terminal
2. Navigate to downloads folder: cd ~/Downloads
3. Make the installer executable:
chmod +x xampp-linux-x64-*.run
4. Run the installer:
sudo ./xampp-linux-x64-*.run
5. Follow the setup wizard prompts
6. Installation location: /opt/lampp/
7. Launch XAMPP: sudo /opt/lampp/lampp start
Step 5: Start Apache and MySQL Services
Once everything is installed, open the XAMPP Control Panel and start Apache and MySQL. When both services turn green, it means your server is running perfectly.
1. Open XAMPP Control Panel
2. You will see a list of services:
- Apache (Web Server)
- MySQL (Database Server)
3. Click the "Start" button next to Apache
- The module name should turn GREEN
4. Click the "Start" button next to MySQL
- The module name should turn GREEN
5. Both services should now show "Running" status
Step 6: Verify Your Installation
Finally, open your browser and type `localhost`. If you see the XAMPP dashboard, congratulations! Your local server is successfully set up and ready to use.
1. Open your web browser
2. Type this address in the address bar:
http://localhost
or
http://127.0.0.1
3. Press Enter
4. You should see the XAMPP welcome page / dashboard
5. This confirms your local server is running!
Understanding the XAMPP Control Panel
| Button / Module | Function |
|---|---|
| Apache Start/Stop | Starts or stops the web server |
| MySQL Start/Stop | Starts or stops the database server |
| Config | Opens configuration files for each module |
| Logs | Shows error and access logs for debugging |
| Explorer | Opens the module's folder in File Explorer |
| Services | Manages Windows services (Windows only) |
Where to Put Your Website Files
All your website files must go inside the `htdocs` folder. This is the root directory for your local web server.
Windows: C:\xampp\htdocs\
macOS: /Applications/XAMPP/htdocs/
Linux: /opt/lampp/htdocs/
To access your website in browser:
http://localhost/your-folder-name/
Troubleshooting Common Issues
| Problem | Solution |
|---|---|
| Apache won't start (port 80 in use) | Change Apache port to 8080 or stop the program using port 80 |
| MySQL won't start (port 3306 in use) | Stop other MySQL services or change MySQL port |
| localhost not loading | Make sure Apache is started, clear browser cache, restart browser |
| Access forbidden / 403 error | Check file permissions and ensure index.html or index.php exists |
1. Open XAMPP Control Panel
2. Click "Config" next to Apache
3. Select "httpd.conf"
4. Find the line: Listen 80
5. Change to: Listen 8080
6. Find: ServerName localhost:80
7. Change to: ServerName localhost:8080
8. Save and restart Apache
9. Access at: http://localhost:8080
What's Next
And just like that, you have created your own development environment right on your computer. Now that XAMPP is installed and running, you can:
- Write your first PHP program
- Create a MySQL database using phpMyAdmin
- Install WordPress locally for testing
- Connect PHP to MySQL database
Frequently Asked Questions
- Is XAMPP free?
Yes, XAMPP is completely free and open-source software. - Can I install XAMPP on any computer?
Yes, XAMPP works on Windows, macOS, and Linux. - Do I need internet to use XAMPP?
No, once installed, you can run XAMPP completely offline. - What is the default MySQL password?
The default username is "root" with no password (leave empty). - How do I uninstall XAMPP?
On Windows, use the uninstaller in the XAMPP folder. On macOS, delete the XAMPP folder from Applications.
