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.

XAMPP Control Panel showing Apache and MySQL running

What's Included in XAMPP

ComponentPurposeAccess
ApacheWeb server (serves your PHP/HTML files)localhost
MariaDB/MySQLDatabase serverPort 3306
PHPServer-side scripting languageProcesses .php files
phpMyAdminDatabase management interfacelocalhost/phpmyadmin
PerlAnother scripting language (optional)-
FileZillaFTP server (optional)Port 21

Installation Guide

Windows

  1. Download XAMPP from apachefriends.org
  2. Run the installer (you may need admin rights)
  3. Choose install location (default: C:\xampp)
  4. Select components (Apache and MySQL are required)
  5. Complete installation
  6. Open XAMPP Control Panel from Start Menu

macOS

  1. Download XAMPP .dmg from apachefriends.org
  2. Open .dmg and drag XAMPP to Applications
  3. Open XAMPP from Applications folder
  4. 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

OSXAMPP LocationWebsite Files (htdocs)
WindowsC:\xampp\C:\xampp\htdocs\
macOS/Applications/XAMPP//Applications/XAMPP/htdocs/
Linux/opt/lampp//opt/lampp/htdocs/

Getting Started

  1. Open XAMPP Control Panel
  2. Click Start next to Apache
  3. Click Start next to MySQL
  4. Open browser and go to http://localhost
  5. 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:
  1. Open C:\xampp\apache\conf\httpd.conf
  2. Find Listen 80 and change to Listen 8080
  3. Find ServerName localhost:80 and change to ServerName localhost:8080
  4. Restart Apache — access site at localhost:8080

MySQL Won't Start — Port 3306 in Use

Cause: Another MySQL instance is running.

Fix:

  1. Open Windows Services (Win+R, type services.msc)
  2. Find "MySQL" service and stop it
  3. 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

TaskWindowsMac/Linux
Start ApacheControl Panel → Startsudo /opt/lampp/lampp startapache
Start MySQLControl Panel → Startsudo /opt/lampp/lampp startmysql
Stop allControl Panel → Stopsudo /opt/lampp/lampp stop
RestartStop then Startsudo /opt/lampp/lampp restart

Install WordPress on XAMPP

  1. Download WordPress from wordpress.org
  2. Extract to C:\xampp\htdocs\wordpress\
  3. Open phpMyAdmin and create a database named "wordpress"
  4. Visit localhost/wordpress and follow setup
  5. 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