Suzanne Scacca

Staff Writer

How to Install WordPress Locally with XAMPPHave you ever wished you could mess around with WordPress without the trouble or cost of installing it on a web hosting server?

Staging environments are perfectly fine when you need to debug issues or test updates before pushing to a live WordPress website. But what about when you want to:

  • Try out new plugins?
  • Take a theme for a test spin or build your own?
  • Explore a new WordPress feature?
  • Experiment with a trending design or coding technique?
  • Continue working on a website even when wi-fi connectivity is sparse or non-existent?

In those cases, it’s best to install WordPress locally on your computer. So, today, we’re going to show you how to install WordPress on XAMPP.

How to Install WordPress Locally with XAMPP

Despite making its open-source software readily available for download, WordPress is not something that can be installed on your computer. Not on its own anyway.

If you want to install WordPress on the localhost (i.e. your computer), you’re going to need assistance.

Start here:

Step 1: Choose a Local Server Environment

In order to get a working installation of WordPress going on your computer, you need a local environment with:

  • Web server software (usually an Apache server),
  • A programming language like PHP or Perl,
  • And database management software like MySQL or MariaDB.

XAMPP is the one we’re going to walk you through today. That said, there are other options available, if you prefer:

  • WampServer for Windows operating systems
  • MAMP for Mac or Windows
  • DesktopServer for Mac or Windows
  • Local by Flywheel for Mac, Windows, or Linux environments (and is especially useful if you have Flywheel hosting you want to migrate your test site too)

Setup isn’t really complicated with any of these options. However, because XAMPP is a popular dev environment and it’s device-agnostic (Mac, Windows, and Linux compatible), we’re going to focus on that one today.

Step 2: Download XAMPP

Visit the Apache Friends website and download the latest version of XAMPP for your operating system:


The file will automatically start to download.

When it’s done, add XAMPP to your applications and start the loading process.


Depending on your operating system, you may need to accept a number of access permissions before the application fully loads. When it’s ready to go, though, this is the window you will see:

XAMPP Application

XAMPP is now installed on your computer.

Step 3: Configure Your XAMPP Environment

Click the “Start” button inside your XAMPP app to initialize the setup of the local environment. The Status light will change from red to yellow to green:

XAMPP Status Light

XAMPP isn’t the only thing that needs to start. Go to the Services tab and do the same thing for each of the stack services until they turn green:

XAMPP Services

Next, go to the Network tab. You will need to choose where you want your localhost server to live:

XAMPP Network

Choose from any of the available options and click “Enable”.

Note: If you plan on turning this into a WordPress Multisite, you can only use ports 80 or 443. If that’s the case, you can create whichever one you want to use now or use the workaround later (more on that at the bottom of this post).

One last thing to do is go to the Volumes tab. Click “Mount”.


This will “stick” the localhost to your desktop (you’ll need this later to modify your website’s files).

Step 4: Create a Database

You have just one more thing to do.

Open a new browser tab and type the name of the localhost you enabled. For instance:

Localhost in Browser

You’ll be taken to a welcome page for XAMPP:

XAMPP Welcome Page

To add a new database, click on the phpMyAdmin button in the top-right corner of this page. phpMyAdmin will automatically launch:


Before we add WordPress to the local server, we first need a database for it. Go to the Databases tab at the top of the page.

Create Database

Give your database a name (use all lowercase letters and underscores instead of spaces). Then, update the drop-down menu from utf8 to Collation. Click the “Create” button when you’re done.

Step 5: Download WordPress

To retrieve the latest version of WordPress, go to the WordPress.org website. Click “Get WordPress” in the top-right corner of the page:

Get WordPress

You can download the zip file from the next page:

Download WordPress Software

Step 6: Update the wp-config.php File

Unzip your WordPress files and locate wp-config-sample.php.

WordPress Files

This file contains key information about your WordPress website and is what enables WordPress software to store information in the MariaDB (or MySQL) database you just created. However, there’s placeholder information in here we need to update.

Open the file using a text editor.

Atom wpconfig

The following lines need to be edited:

Database Name

Locate this line:

define( 'DB_NAME', 'database_name_here' );

If you don’t remember what you named your database in phpMyAdmin, you can find it here:

Database Name

Then, replace “database_name_here” with your database’s name. In our example, the line would become:

define( 'DB_NAME', 'my_database' );

Username and Password

Next, locate these two lines:

define( 'DB_USER', 'username_here' );

define( 'DB_PASSWORD', 'password_here' );

Replace “username_here” with “root” and leave “password_here” empty. So, the lines should now read:

define( 'DB_USER', 'root' );

define( 'DB_PASSWORD', '' );

When you’re done, save the file and rename it as wp-config.php. Make sure it’s inside the original WordPress file folder.

Step 7: Install WordPress on the Localhost

To install WordPress locally, you need to move your downloaded files (unzipped) — including the new wp-config.php file — to XAMPP’s htdocs folder.

You’ll find it here:

File Directory HTDOCS

Rename the folder if you’d like it to be called something other than “wordpress”. A temporary domain name will do.

To access your new WordPress install, go to the original localhost address you used in the beginning, followed by your new WordPress folder name. Add “/wp-admin/” to the end.

For example:


You’ll then see this installation page:

Localhost wp-admin

Fill in all of the details — including your admin username and password — and complete the installation. When you’re done, you’ll be taken here:

New WordPress Install

And that’s it. You’ve now successfully installed WordPress locally with XAMPP.

To access your local site in the future, load the XAMPP app and “Start” the local server. Then go to your localhost web address and log back in. (So, make sure to bookmark it.)

How to Install WordPress Multisite on Localhost

If you want to test things out on a WordPress Multisite network, you can do this with XAMPP as well.

Steps 1-7: Install WordPress Locally

To activate Multisite, you’ll need to complete Steps 1 through 7 first.

Step 8: Activate WordPress Multisite

Open the wp-config.php file once more from the htdocs folder.

Find the line:

/* That's all, stop editing! Happy publishing. */

Just above it, insert the following Multisite activation string:

define('WP_ALLOW_MULTISITE', true);

Save the file.

Log out of your local WordPress site and log back in again. Go to Tools > Network Setup.

Tools Network Setup

As noted earlier, WordPress only allows Multisite to run through network ports 80 or 443. If you didn’t originally configure XAMPP through one of those ports, that’s okay. Use this workaround.

Go to your XAMPP folder and locate the following:

/(your website folder name)/wp-admin/includes/network.php

Inside this file, there’s a line that says:

if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) {

This is the reason you might see an error when trying to access Network Setup in WordPress. To fix this, add the port you ended up using to the code. For example:

if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ,':8080') ) ) ) {

Save the file and return to Network Setup in WordPress.

You’ll be asked to give your network of websites a name and designate an admin user.

Create a Network

Then, you’ll see these instructions:

Enable the Network

You’ll need to update both your wp-config.php and .htaccess files. If you can’t find the .htaccess file, you’ll have to create it from scratch. Open your text editor, insert the code snippet, and save it to the folder.

Once you’ve saved both of those files, log out of WordPress once more. When you log back in again, you’ll see that WordPress Multisite has been installed locally.

New WordPress Multisite Install


It’s never a good idea to build, experiment, or troubleshoot on a live WordPress installation.

In cases where the work you do needs to be pushed to a live site, it makes more sense to use a staging server or subdomain. However, if you’re testing new features, design techniques, or tools, working locally is a better idea. (It’s cheaper, too.)

Thanks to XAMPP, all it takes is 7 steps and no more than 15 minutes to install WordPress locally.