How to Install WordPress on Localhost Using XAMPP

Image

Introduction

WordPress is the most popular content management system (CMS) worldwide, powering millions of websites. Before publishing a WordPress site online, you can test and develop it locally using XAMPP, a free and open-source cross-platform web server solution. This guide will walk you through the step-by-step process of installing WordPress on a localhost environment using XAMPP.

By the end of this tutorial, you will have a fully functional WordPress website running on your computer, allowing you to develop and experiment without affecting a live site.


Image

Prerequisites

Before installing WordPress on XAMPP, ensure you have the following:

  1. A Windows, macOS, or Linux computer – XAMPP is compatible with all major operating systems.
  2. XAMPP installed – Download it from Apache Friends.
  3. WordPress files – Download the latest version from WordPress.org.
  4. A web browser – Chrome, Firefox, or Edge for testing.

Now that you're ready, let's proceed with the installation.


Image

1. Install and Configure XAMPP

Step 1: Download and Install XAMPP

  1. Go to Apache Friends and download the XAMPP installer for your operating system.
  2. Run the installer and follow the on-screen instructions.
  3. During installation, select the following components:
    • Apache (webserver)
    • MySQL (database)
    • PHP (scripting language)
    • phpMyAdmin (database management tool)

Click "Next" and complete the installation.

Step 2: Start Apache and MySQL

After installing XAMPP:

  1. Open the XAMPP Control Panel.
  2. Click "Start" next to Apache and MySQL.
    • If the services start successfully, you will see a green indicator.
    • If they fail to start, check for conflicts (e.g., port 80 may be blocked by Skype or another application).

Step 3: Verify Installation

  1. Open your web browser and visit:
    http://localhost
    
  2. You should see the XAMPP dashboard, confirming that the server is running.

Now that XAMPP is set up, we can proceed to install WordPress.


Image

2. Set Up a Database for WordPress

WordPress requires a MySQL database to store its data. We'll create one using phpMyAdmin.

Step 1: Access phpMyAdmin

  1. In your browser, navigate to:
    http://localhost/phpmyadmin
    
  2. Log in (default credentials are usually Username: root, Password: blank).

Step 2: Create a New Database

  1. Click on "Databases" in the top menu.
  2. Under "Create database", enter a name (e.g., wordpress_db).
  3. Choose "utf8_general_ci" as the collation.
  4. Click "Create".

Step 3: Create a Database User (Optional)

For security, it's best to create a dedicated MySQL user for WordPress.

  1. Go to the "User accounts" tab.
  2. Click "Add user account".
  3. Fill in the details:
    • Username: wordpress_user
    • Hostname: localhost
    • Password: Choose a strong password
  4. Under "Database-specific privileges", select your newly created database (wordpress_db).
  5. Grant All privileges and click "Go".

Now that the database is ready, we can proceed with WordPress installation.


3. Install WordPress on Localhost

Step 1: Download and Extract WordPress

  1. Go to WordPress.org/download and download the latest version.
  2. Extract the ZIP file into the "htdocs" folder inside your XAMPP installation directory (usually C:\xampp\htdocs on Windows or /opt/lampp/htdocs on Linux/macOS).
  3. Rename the extracted folder to your preferred site name (e.g., mysite).

Step 2: Configure WordPress

  1. Open your browser and navigate to:
    http://localhost/mysite
    
  2. WordPress will prompt you to begin the installation.

Step 3: Run the WordPress Installation Wizard

  1. Select your language and click "Continue".
  2. Click "Let's go!" on the next screen.
  3. Enter your database details:
    • Database Name: wordpress_db
    • Username: root (or wordpress_user if you created a separate user)
    • Password: (Leave blank or use the one you set)
    • Database Host: localhost
    • Table Prefix: wp_ (default)
  4. Click "Submit", then "Run the installation".

Step 4: Complete the Setup

  1. Enter your site details:
    • Site Title
    • Username (admin account)
    • Password (keep it secure)
    • Email
  2. Click "Install WordPress".
  3. Once installed, click "Log In" to access the WordPress dashboard.

Congratulations! WordPress is now installed on your localhost.


4. Accessing and Customizing Your WordPress Site

Step 1: Log in to the WordPress Dashboard

  1. Go to:
    http://localhost/mysite/wp-admin
    
  2. Enter your username and password.

Step 2: Install a Theme

  1. Navigate to: Appearance > Themes.
  2. Click "Add New", browse themes, and install your preferred one.

Step 3: Install Plugins

  1. Go to Plugins > Add New.
  2. Search for essential plugins (e.g., Yoast SEO, Elementor, Contact Form 7) and install them.

Step 4: Create Pages and Posts

  1. For posts: Posts > Add New.
  2. For pages: Pages > Add New.

Now you have a fully functional WordPress site running locally!


5. Troubleshooting Common Issues

1. XAMPP Apache/MySQL Not Starting

  • Solution: Check for port conflicts (e.g., Skype using port 80). Change the ports in XAMPP's httpd.conf or stop conflicting applications.

2. Database Connection Error

  • Solution: Double-check your MySQL credentials in wp-config.php.

3. WordPress Installation Stuck

  • Solution: Ensure mod_rewrite is enabled in Apache and the .htaccess file is properly configured.

4. White Screen After Installation

  • Solution: Increase PHP memory limit in php.ini (located in XAMPP's PHP folder).

Conclusion

Setting up WordPress on localhost using XAMPP is a straightforward process that allows you to develop, test, and experiment without affecting a live website. By following this guide, you’ve successfully:

✅ Installed XAMPP and configured Apache & MySQL
✅ Created a MySQL database for WordPress
✅ Installed WordPress and completed the setup
✅ Accessed & customized your local WordPress site

Now you can safely build and test plugins, themes, and content before deploying them to a live server. Happy WordPress development! 🚀

Advertisement

0 Comments