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.
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
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. |
Official download: Download XAMPP from Apache Friends
Open the XAMPP Control Panel and start the following services:
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.
Official download: Download WordPress
In a typical Windows XAMPP installation, website files are stored
in the htdocs directory.
For example:
C:\xampp\htdocs\wordpress
wordpress inside htdocs, if needed.Your folder should look similar to this:
C:\xampp\htdocs\
wordpress\
wp-admin\
wp-content\
wp-includes\
index.php
wp-config-sample.php
index.php is directly inside the
wordpress folder. Avoid accidentally creating an
extra nested folder such as
htdocs/wordpress/wordpress/.
WordPress needs a database to store posts, pages, users, settings, and other website information.
http://localhost/phpmyadmin/.wordpress_db.utf8mb4, if prompted.Database name: wordpress_db
Database server: localhost
Database user: Use the account configured for your local database.
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.
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.
WordPress will ask you to enter basic website information, such as:
Enter your details and complete the installation. Avoid using an easily guessed administrator username or password.
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.
| 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. |
wordpress_db.htdocs folder.wp-admin page opens the administration login.Choose the correct answer for each question.