Setting Up a Local Environment for WordPress With XAMPP

If you’re diving into WordPress development, setting up a local environment is one of the easiest and most effective ways to get started. It lets you build and test your site safely and quickly on your own computer, away from the risks of a live server.

This guide will focus on a beginner-friendly way: using XAMPP.

What is a Local Environment?

A local development environment is a setup where your website files and server are hosted directly on your computer, not on the internet. By working locally, you can test new features, tweak designs, and fix bugs without worrying about crashing a live website.💥

What is XAMPP?

XAMPP is a beginner-friendly open-source tool that lets you set up a local server. It includes:

  • Apache: The web server that runs your site.

  • MySQL: The database manager for storing site content.

  • PHP: The programming language WordPress relies on.

With XAMPP, you can mimic a real web server on your computer, so WordPress can run smoothly in a local environment.

Alright, Let’s get started!

Step 1: Download and Install XAMPP

  • Download XAMPP: Go to XAMPP’s website and download the installer for your operating system. Choose the latest version of PHP, unless your project requires an older version.

  • Install XAMPP: Open the downloaded file to start the installation. After clicking next once, you will get to see a selection of components for you to choose to install.

    • The required components you need are:

      • MySQL: Manages your database.

      • phpMyAdmin: A database management tool.
        The rest you can uncheck, unless you have specific needs to use some other components, but this is pretty much all you need to host your WordPress website locally.
        Select which folder you want to install XAMPP in. You can leave it like it is, in your C drive, if you want.

      • Start XAMPP Services: Once the installation is complete, launch the XAMPP control panel.
        Click on the start buttons to run the Apache server and the MySQL database:

        After clicking start, their status should turn to green.

        To confirm everything is working, open your browser and go to http://localhost/dashboard/. If the XAMPP dashboard loads, you’re ready to proceed ⏭️

Step 2: Create a Database

Every WordPress site needs a database to store its content. To create one, go to http://localhost/phpmyadmin in your browser. This will open phpMyAdmin, a user-friendly tool for managing databases.

Once you’re in, click on the ‘Databases’ tab, and provide a name for your new database. After that, click on the ‘Create’ button to continue.

And that's it, your database is created!

Step 3: Installing WordPress

Download WordPress from the official WordPress website.
Once the file is downloaded, extract it—you’ll see a folder called: wordpress.

  • Move WordPress to XAMPP Copy the WordPress folder and go to the location where you installed XAMPP.
    Open the xampp folder and inside open the folder called: htdocs.

    On Windows, the path is usually C:/xampp/htdocs; on Mac, it’s /Applications/XAMPP/htdocs. Paste the wordpress folder in htdocs, and rename the wordpress folder to match your project’s name, my example will be: My_Project.

  • Run the WordPress installer: Enter the following URL into your browser’s address bar: http://localhost/My_Project/.
    Make sure to replace the name My_Project with your folders name.

    Now the WordPress installation wizard will show up, and you’ll be asked to select a language.

Step 4: Configure WordPress

  • After you selected a language, go ahead and click on next until you get to the database details. Enter them like this:

    • Database Name = Name of the database you created in phpMyAdmin

    • Username = “root”

    • Password = leave blank

    • Database Host = localhost

    • Table Prefix = wp_

      When clicking submit, WordPress will save this information in a configuration file called wp-config.php.

    • In the next step, WordPress will ask you to provide information about your website. First, enter the title you want to use for this site. After that, you need to enter a username, password, and email address for your admin account.
      Hit the 'Install WordPress' button after filling out the information. WordPress will now run the installation and prompt you to log in once it’s done.

Final Step 5: Log In to WordPress

You can log in to your website by going to the http://localhost/My_Project/wp-admin page and using the username and password that you entered during the installation setup.

Hurray, you did it!🎊
You’ve just set up a local WordPress environment using XAMPP. Now you can start building and customizing your site with complete freedom.

5
Subscribe to my newsletter

Read articles from Dannique de Klerk directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Dannique de Klerk
Dannique de Klerk