Lesson 5 of 50 – Install WordPress on Localhost
10% Completed
10%

Install WordPress on Localhost

Learn how to install WordPress on your own computer using XAMPP. A local installation allows you to practice building websites without publishing them on the internet.

Learning Objective: By the end of this lesson, you will understand how to install XAMPP, create a database, configure WordPress, and open the WordPress dashboard.

1. What Is Localhost?

Localhost refers to the computer you are currently using as a server. When WordPress is installed locally, your computer runs the required server software and displays your website in a browser.

For example, a local WordPress website might use this address:

http://localhost/wordpress
Remember: A localhost website is normally accessible only from your own computer unless you deliberately configure network access.

2. What Is XAMPP?

XAMPP is a development package that provides tools for running websites locally. It includes Apache, MariaDB, PHP, and other utilities.

Component Purpose
Apache Runs the local web server.
MariaDB Stores WordPress website data.
PHP Executes WordPress server-side code.
phpMyAdmin Provides a browser-based interface for managing databases.

3. Step 1: Download and Install XAMPP

  1. Open the official Apache Friends website.
  2. Download the XAMPP version suitable for your operating system.
  3. Run the installer and follow the installation instructions.
  4. Complete the installation.
  5. Open the XAMPP Control Panel.

Official download: Download XAMPP from Apache Friends

Tip: For this lesson, use a PHP version compatible with the WordPress release you intend to install.

4. Step 2: Start Apache and MySQL

Open the XAMPP Control Panel and start the following services:

  • Apache — handles browser requests.
  • MySQL — the XAMPP Control Panel label for the database service, which uses MariaDB in standard XAMPP packages.

When both services are running, open your browser and visit:

http://localhost/

If the local XAMPP page opens, the web server is responding. If a service fails to start, another application may be using the same port.

5. Step 3: Download WordPress

  1. Visit the official WordPress website.
  2. Download the WordPress ZIP package.
  3. Extract the downloaded ZIP file.

Official download: Download WordPress

6. Step 4: Copy WordPress into htdocs

In a typical Windows XAMPP installation, website files are stored in the htdocs directory.

For example:

C:\xampp\htdocs\wordpress
  1. Open the folder where you extracted WordPress.
  2. Copy its WordPress files and folders.
  3. Create a folder named wordpress inside htdocs, if needed.
  4. Place the WordPress files inside that folder.

Your folder should look similar to this:

C:\xampp\htdocs\
    wordpress\
        wp-admin\
        wp-content\
        wp-includes\
        index.php
        wp-config-sample.php
Ensure that index.php is directly inside the wordpress folder. Avoid accidentally creating an extra nested folder such as htdocs/wordpress/wordpress/.

7. Step 5: Create a WordPress Database

WordPress needs a database to store posts, pages, users, settings, and other website information.

  1. Open your browser.
  2. Visit http://localhost/phpmyadmin/.
  3. Open the Databases section.
  4. Create a database named wordpress_db.
  5. Choose a suitable character set, such as utf8mb4, if prompted.
Example Database Details

Database name: wordpress_db

Database server: localhost

Database user: Use the account configured for your local database.

Security note: Do not assume that the default database account is secure for a public website. For online hosting, use the database credentials provided or configured securely for your hosting environment.

8. Step 6: Open the WordPress Installer

After placing the WordPress files in htdocs and creating the database, open:

http://localhost/wordpress

The WordPress setup screen should appear. Follow the prompts to select your language and continue the installation.

9. Step 7: Enter Database Details

Enter the database information requested by the installer.

Field Example for a Typical Local Setup
Database Name wordpress_db
Username root, if that is your local database account
Password Use the password configured for that account; some local setups have an empty password by default
Database Host localhost
Table Prefix wp_ (default example)

Continue through the installer. If WordPress cannot connect to the database, verify the database name, username, password, host, and whether the database service is running.

10. Step 8: Configure Your Website

WordPress will ask you to enter basic website information, such as:

  • Site Title: The name of your website.
  • Username: Your WordPress administrator username.
  • Password: A strong password for the administrator account.
  • Email: An email address for website administration.

Enter your details and complete the installation. Avoid using an easily guessed administrator username or password.

11. Step 9: Log In to the WordPress Dashboard

After installation, open the login page:

http://localhost/wordpress/wp-admin

Enter the administrator username and password you created. The WordPress dashboard lets you manage posts, pages, themes, plugins, users, and website settings.

12. Common Installation Problems

Problem Possible Solution
Apache will not start Check whether another application is using the required port.
MySQL service will not start Check the XAMPP logs and resolve any database service or port conflict.
Error establishing a database connection Verify the database name, credentials, host, and database service status.
Object or page not found Check the folder name and URL, and ensure WordPress files are in the correct directory.
Installer does not appear Confirm Apache is running and open the correct localhost URL.
PHP compatibility error Use a supported PHP version that is compatible with your WordPress release.

13. Practical Assignment

Practice Task
  1. Install XAMPP on your computer.
  2. Start Apache and the database service.
  3. Create a database named wordpress_db.
  4. Download WordPress and place its files in the correct htdocs folder.
  5. Open the local WordPress installer and follow the setup steps.
  6. Log in to the dashboard and note the website title.

14. Lesson Summary

  • XAMPP provides a local environment for practicing WordPress.
  • Apache serves the website, PHP executes WordPress code, and MariaDB stores data.
  • WordPress files must be placed in the correct web directory.
  • A database must be created before completing the installation.
  • The installer configures the database connection and administrator account.
  • The wp-admin page opens the administration login.

Practice Quiz

Choose the correct answer for each question.

1. Which XAMPP component runs the local web server?

2. Where are WordPress files usually placed in a default Windows XAMPP installation?

3. Which URL commonly opens the WordPress administration login for a local installation named wordpress?