Skip to main content
Wordpress Getting Started & Setup

How to Install and Configure WordPress on Localhost (XAMPP / MySQL)

How to Install and Configure WordPress on Localhost (XAMPP / MySQL)

Running WordPress in a local development environment is essential for building custom plugins, testing core updates, and staging configuration changes without risking production availability. This guide details the complete workflow for setting up WordPress on a local Apache and MySQL/MariaDB stack using XAMPP on Windows.

Note: > This guide is tailored for XAMPP environments running on Windows (C:xampp), but the directory permissions, MySQL collation choices, and wp-config.php constants apply equally to Linux (LAMP) and macOS (MAMP/Docker) setups.

1. System Requirements & Stack Verification

Before downloading WordPress, verify that your local web stack meets the minimum requirements:

Component Minimum Version Recommended Version
PHP

7.4+ | 8.1 or 8.2 with curl, mbstring, mysqli, openssl, zip |
| Database | MySQL 5.7+ / MariaDB 10.4+ | MariaDB 10.4+ with utf8mb4_unicode_ci |
| Web Server | Apache 2.4+ / Nginx 1.20+ | Apache 2.4 with mod_rewrite enabled |
| HTTPS | Optional for local dev | Recommended via self-signed OpenSSL cert or mkcert |

To verify that your PHP CLI and MySQL services are active, open PowerShell:

php -v
mysql -u root -e "SELECT VERSION();"

2. Setting Up the Database in MySQL / phpMyAdmin

WordPress requires a dedicated database and user privileges to store tables, metadata, and options.

Option A: Via Command Line (Fastest)

CREATE DATABASE `xyphla_wp_local` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL PRIVILEGES ON `xyphla_wp_local`.* TO 'root'@'localhost';
FLUSH PRIVILEGES;

Option B: Via phpMyAdmin Web Interface

  1. Open your browser and navigate to http://localhost/phpmyadmin/.
  2. Click New in the left sidebar.
  3. Enter database name: xyphla_wp_local.
  4. Select collation: utf8mb4_unicode_ci (critical for full emoji and international UTF-8 support).
  5. Click Create.
Tip: > Always use utf8mb4_unicode_ci or utf8mb4_520_unicode_ci. Using older utf8_general_ci can cause 4-byte character truncation issues and database query warnings.

3. Extracting and Organizing WordPress Core Files

  1. Download the latest official WordPress zip package from wordpress.org/download.
  2. Extract the archive into your XAMPP root document directory:
   C:xampphtdocsxyphla-wp
   ```
3. Ensure the folder contains root files directly: `index.php`, `wp-config-sample.php`, `wp-load.php`, and directories `wp-admin`, `wp-includes`, and `wp-content`.

---

## 4. Configuring `wp-config.php`

Copy `wp-config-sample.php` to `wp-config.php` in the site root directory:

powershell
Copy-Item C:xampphtdocsxyphla-wpwp-config-sample.php C:xampphtdocsxyphla-wpwp-config.php


Open `wp-config.php` in your code editor and configure your database parameters:

php
// Database settings – You can get this info from your web host //
/ The name of the database for WordPress /
define(‘DBNAME’, ‘xyphlawplocal’);

/ Database username /
define(‘DB
USER’, ‘root’);

/ Database password (default is empty in XAMPP) /
define(‘DBPASSWORD’, ”);

/ Database hostname /
define(‘DB
HOST’, ‘localhost’);

/ Database charset to use in creating database tables. /
define(‘DBCHARSET’, ‘utf8mb4’);

/ The database collate type. Don’t change this if in doubt. /
define(‘DB
COLLATE’, ”);


### Generating Unique Authentication Keys and Salts

Visit [api.wordpress.org/secret-key/1.1/salt/](https://api.wordpress.org/secret-key/1.1/salt/) and paste the generated cryptographic hashes into your `wp-config.php`:

php
define(‘AUTHKEY’, ‘put your unique phrase here’);
define(‘SECURE
AUTHKEY’, ‘put your unique phrase here’);
define(‘LOGGED
INKEY’, ‘put your unique phrase here’);
define(‘NONCE
KEY’, ‘put your unique phrase here’);
define(‘AUTHSALT’, ‘put your unique phrase here’);
define(‘SECURE
AUTHSALT’, ‘put your unique phrase here’);
define(‘LOGGED
INSALT’, ‘put your unique phrase here’);
define(‘NONCE
SALT’, ‘put your unique phrase here’);


### Enabling Developer Debugging

In local environments, always enable debugging logs to catch notices and deprecated functions early:

php
// Local Development Debug Settings
define(‘WPDEBUG’, true);
define(‘WP
DEBUGLOG’, true);
define(‘WP
DEBUGDISPLAY’, false);
define(‘SCRIPT
DEBUG’, true);
define(‘SAVEQUERIES’, true);


> [!WARNING]
> Never leave `WP_DEBUG_DISPLAY` set to `true` or `WP_DEBUG` active on a production-facing public server, as this could expose sensitive system paths and database credentials to visitors.

---

## 5. Running the 5-Minute Web Installer

1. Open your browser and navigate to:
   ```text
   http://localhost/xyphla-wp/
   ```
2. Select your preferred system language and click **Continue**.
3. Fill in the installation form:
   - **Site Title:** `Xyphla Local Development`
   - **Username:** `admin` (or your chosen developer handle)
   - **Password:** Choose a secure password and store it in your password manager.
   - **Your Email:** Enter your working administrative email address.
   - **Search engine visibility:** Check *Discourage search engines from indexing this site* (recommended for local development).
4. Click **Install WordPress**.
5. Once complete, click **Log In** and enter your credentials.

---

## 6. Configuring Clean Permalinks (.htaccess)

To enable human-readable URLs and support WordPress REST API routes (`/wp-json/`):

1. Go to **Settings > Permalinks** in the WordPress admin bar.
2. Select **Post name** (`/%postname%/`).
3. Click **Save Changes**.

Ensure an `.htaccess` file exists in `C:xampphtdocsxyphla-wp.htaccess` with the following rules:

apache

BEGIN WordPress

<IfModule modrewrite.c>
RewriteEngine On
RewriteRule .* – [E=HTTP
AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /xyphla-wp/
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUESTFILENAME} !-f
RewriteCond %{REQUEST
FILENAME} !-d
RewriteRule . /xyphla-wp/index.php [L]

END WordPress

“

---

## 7. Verification Checklist

Verify your setup by running through this final checklist:

- [x] WordPress admin dashboard loads at http://localhost/xyphla-wp/wp-admin/
- [x] REST API endpoint returns valid JSON at
http://localhost/xyphla-wp/wp-json/
- [x] Media upload directory
wp-content/uploads/ is writable
- [x] Debug log file is created in
wp-content/debug.log` when test errors trigger

Was this technical article helpful?

Help us continuously refine Xyphla documentation.