How to install WordPress with XAMPP

Set up a local WordPress site on XAMPP by creating a MariaDB database, downloading WordPress, and configuring wp-config.php on Windows.

Install WordPress on a local XAMPP server to develop and test themes, plugins, and site configurations without a live hosting environment.

Prerequisites

  • XAMPP installed on Windows. See How to install XAMPP on Windows.
  • Apache HTTP Server and MariaDB (MySQL) running from the XAMPP Control Panel.
  • A web browser to access http://localhost and phpMyAdmin.

Step-by-Step: Install WordPress on XAMPP

  1. Start Apache HTTP Server and MariaDB from the XAMPP Control Panel. Click the Startbutton next to both Apache and MySQL. Both services display green status indicators when running.

    XAMPP control panel with Apache and MySQL started

  2. Verify XAMPP is running. Open a web browser and navigate to http://localhost. The XAMPP dashboard page confirms that Apache HTTP Server is serving files correctly.

    XAMPP localhost dashboard in web browser

  3. Create a database for WordPress. Open phpMyAdmin at http://localhost/phpmyadmin/. Click the Databasestab. Enter a database name (for example, wordpress_db). Select utf8mb4_general_ci as the collation. Click Create.

  4. Create a project folder in the XAMPP htdocs directory. Navigate to the XAMPP installation folder (default: C:\xampp\htdocs) and create a new folder for the WordPress site (for example, demo).

    XAMPP htdocs folder structure

  5. Download WordPress from the official WordPress website. Extract the ZIP file contents into the project folder created in the previous step (for example, C:\xampp\htdocs\demo).

    WordPress files extracted in XAMPP demo folder

  6. Verify the folder structure. The project folder should contain WordPress core files such as wp-admin, wp-content, wp-includes, and wp-config-sample.php.

    WordPress files structure in XAMPP demo folder

  7. Open the WordPress setup wizard. Navigate to http://localhost/demo in the web browser. WordPress displays the language selection and database configuration screens.

    WordPress setup page in web browser

  8. Configure the WordPress database connection. Rename wp-config-sample.php to wp-config.php inside the project folder. Open wp-config.php in a text editor and set the database name, username, and password:

    define( 'DB_NAME', 'wordpress_db' );
    define( 'DB_USER', 'root' );
    define( 'DB_PASSWORD', '' );
    define( 'DB_HOST', 'localhost' );

    XAMPP ships with a default MariaDB root user that has no password. The DB_HOST value is localhost because MariaDB runs on the same machine.

  9. Enable WordPress debug mode for local development. Open wp-config.php and change the WP_DEBUG constant to true:

    define( 'WP_DEBUG', true );

    WordPress debug mode displays PHP errors, warnings, and notices directly on the page. This setting helps identify issues during theme and plugin development.

    WordPress wp-config.php file with debug mode enabled

  10. Complete the WordPress installation. Navigate to http://localhost/demo in the web browser. Follow the on-screen wizard to set the site title, admin username, password, and email address.

How to Verify WordPress Installed Correctly on XAMPP

Open http://localhost/demo in a web browser. The WordPress homepage loads with the default theme. Log in to the WordPress admin dashboard at http://localhost/demo/wp-admin/ using the credentials created during setup.

Common Issues When Installing WordPress on XAMPP

"Error establishing a database connection."WordPress cannot connect to MariaDB. Verify that the DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST values in wp-config.php match the database created in phpMyAdmin. Confirm that MariaDB is running in the XAMPP Control Panel.

White screen or PHP errors.Set WP_DEBUG to true in wp-config.php to display error messages. Common causes include missing PHP extensions or incorrect file permissions on the WordPress directory.

phpMyAdmin not loading.Confirm that both Apache HTTP Server and MariaDB are running in the XAMPP Control Panel. Navigate to http://localhost/phpmyadmin/ to verify access.