Setting up a local WordPress environment with XAMPP is still the fastest way to test themes, break plugins, and tweak code without risking your live site. I’ve done it dozens of times, and honestly, it’s a 15-minute job once you know the pitfalls. This guide walks you through the exact steps, plus the gotchas that trip people up.
Why Bother With a Local WordPress Install?
A local WordPress development environment lets you work offline, experiment freely, and roll back mistakes instantly. No FTP, no hosting panel, no panic when a plugin nukes your homepage.
XAMPP bundles Apache, MySQL (or MariaDB), and PHP into one installer. That’s the exact stack WordPress needs. You don’t have to configure anything manually—just click through and go.
On Windows, Mac, or Linux, this setup works the same. If you’re on Apple Silicon, grab the native XAMPP build; Intel versions run through Rosetta and feel sluggish.
Step 1: Download and Install XAMPP
Head to the official Apache Friends site and grab the latest XAMPP version. For 2026, that’s typically PHP 8.2 or 8.3—both fully compatible with WordPress 6.x.
During installation, you can uncheck unnecessary modules like Mercury and Tomcat. They just add bloat. Keep Apache, MySQL, PHP, and phpMyAdmin.
Once installed, launch the XAMPP Control Panel. Start the Apache module and the MySQL module. If Apache refuses to start, port 80 is likely taken by Skype or IIS. Change Apache’s port to 8080 in the config, then use localhost:8080 in your browser.
Step 2: Get WordPress and Drop It in htdocs
Download the latest WordPress ZIP from wordpress.org. Don’t grab it from random sites—there are plenty of tampered packages floating around.
Extract the contents into the htdocs folder inside your XAMPP installation directory. On Windows, that’s usually C:xampphtdocs. On Mac, it’s /Applications/XAMPP/htdocs.
Rename the extracted folder from wordpress to something short like mysite. Spaces and capital letters in folder names cause headaches later.
Your WordPress files are now accessible at http://localhost/mysite.
Step 3: Create the MySQL Database
Open your browser and go to http://localhost/phpmyadmin. This is your database control panel.
Click New in the left sidebar. Give your database a name—something like wp_local. For collation, pick utf8mb4_general_ci, not the old utf8_general_ci. Modern WordPress uses utf8mb4 for full emoji and multilingual support.
Hit Create. A local WordPress database is now ready. No user setup needed—XAMPP’s default MySQL user is root with no password.
Step 4: Configure wp-config.php
In your WordPress folder, find wp-config-sample.php. Open it in a code editor like VS Code or Notepad++.
Fill in these values:
- DB_NAME: wp_local (or whatever you named it)
- DB_USER: root
- DB_PASSWORD: leave empty
- DB_HOST: localhost
Save the file as wp-config.php—remove the