XAMPP — Local Web Server for PHP Development
XAMPP is the fastest way to set up a complete PHP development environment on your computer. It bundles Apache (web server), MySQL/MariaDB (database), PHP, and phpMyAdmin (database manager) into a single installer. Whether you're learning PHP, building WordPress sites, or developing web applications, XAMPP lets you test everything locally before deploying to a live server.
What's Included in XAMPP
| Component | Purpose | Access |
|---|---|---|
| Apache | Web server (serves your PHP/HTML files) | localhost |
| MariaDB/MySQL | Database server | Port 3306 |
| PHP | Server-side scripting language | Processes .php files |
| phpMyAdmin | Database management interface | localhost/phpmyadmin |
| Perl | Another scripting language (optional) | - |
| FileZilla | FTP server (optional) | Port 21 |
Installation Guide
Windows
- Download XAMPP from apachefriends.org
- Run the installer (you may need admin rights)
- Choose install location (default:
C:\xampp) - Select components (Apache and MySQL are required)
- Complete installation
- Open XAMPP Control Panel from Start Menu
macOS
- Download XAMPP .dmg from apachefriends.org
- Open .dmg and drag XAMPP to Applications
- Open XAMPP from Applications folder
- Click "Start" for Apache and MySQL
Linux
# Download and install
chmod +x xampp-linux-*-installer.run
sudo ./xampp-linux-*-installer.run
# Start XAMPP
sudo /opt/lampp/lampp start
# Access Control Panel
sudo /opt/lampp/manager-linux-x64.run
XAMPP Installation Paths
| OS | XAMPP Location | Website Files (htdocs) |
|---|---|---|
| Windows | C:\xampp\ | C:\xampp\htdocs\ |
| macOS | /Applications/XAMPP/ | /Applications/XAMPP/htdocs/ |
| Linux | /opt/lampp/ | /opt/lampp/htdocs/ |
Getting Started
- Open XAMPP Control Panel
- Click Start next to Apache
- Click Start next to MySQL
- Open browser and go to http://localhost
- Put your PHP files in the htdocs folder
Troubleshooting Common Errors
Apache Won't Start — Port 80 in Use
Cause: Another program (Skype, IIS, World Wide Web Publishing Service) is using port 80.
Fix options:
- Option 1: Close the conflicting program
- Option 2: Change Apache to port 8080:
- Open
C:\xampp\apache\conf\httpd.conf - Find
Listen 80and change toListen 8080 - Find
ServerName localhost:80and change toServerName localhost:8080 - Restart Apache — access site at localhost:8080
MySQL Won't Start — Port 3306 in Use
Cause: Another MySQL instance is running.
Fix:
- Open Windows Services (Win+R, type
services.msc) - Find "MySQL" service and stop it
- Try starting MySQL in XAMPP again
phpMyAdmin Access Denied (#1045)
Cause: Wrong password entered.
Fix: Leave password field completely empty. Default XAMPP has no MySQL root password.
localhost Shows "It Works!" Instead of My Site
Cause: You're seeing the default Apache page.
Fix: Put your files in htdocs and access them directly (e.g., localhost/myfile.php)
Useful XAMPP Commands
| Task | Windows | Mac/Linux |
|---|---|---|
| Start Apache | Control Panel → Start | sudo /opt/lampp/lampp startapache |
| Start MySQL | Control Panel → Start | sudo /opt/lampp/lampp startmysql |
| Stop all | Control Panel → Stop | sudo /opt/lampp/lampp stop |
| Restart | Stop then Start | sudo /opt/lampp/lampp restart |
Install WordPress on XAMPP
- Download WordPress from wordpress.org
- Extract to
C:\xampp\htdocs\wordpress\ - Open phpMyAdmin and create a database named "wordpress"
- Visit
localhost/wordpressand follow setup - Enter database: wordpress, user: root, password: (blank)
XAMPP Security
By default, XAMPP is configured for development, not security. For local development this is fine, but never expose XAMPP to the internet without securing it:
- Set a MySQL root password
- Restrict phpMyAdmin access
- Don't run XAMPP as a production server