Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Redmond desk10 min

How to Run WordPress Locally With XAMPP (Windows Step-by-Step Guide)

A complete Windows guide to running WordPress locally with XAMPP, including service startup, htdocs folder placement, phpMyAdmin database creation, installer settings, troubleshooting, and security limits.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can run a complete WordPress site on your own computer with XAMPP: install XAMPP, start Apache and MySQL, put WordPress inside XAMPP’s htdocs folder, create a database in phpMyAdmin, and open the installer at a localhost address. Nothing is published to the internet, so it is a safe way to learn WordPress, build a theme, test plugins, or prepare a site before moving it to hosting.

This walkthrough uses the Windows XAMPP Control Panel because its menus and paths are the most commonly documented. XAMPP also has packages for macOS and Linux; use the platform-specific Apache Friends instructions for those systems, then follow the same WordPress folder, database, and installer concepts.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What XAMPP provides—and what you still have to install

XAMPP is a local web-server bundle. It supplies Apache to serve web pages, PHP to execute WordPress code, a MySQL-compatible database server (MySQL or MariaDB, depending on the package), and phpMyAdmin for managing that database. The WordPress files themselves are downloaded separately from WordPress.org.

A local WordPress installation therefore has four moving parts:

  • Apache: receives requests such as http://localhost/my-site/ and serves the files.
  • PHP: runs WordPress’s PHP scripts through Apache.
  • MySQL or MariaDB: stores posts, settings, users, and other site data.
  • WordPress: the application files you place under XAMPP’s web root.

Apache and the database server must be running before the WordPress installer can connect. A browser alone cannot open a WordPress site if Apache is stopped, and WordPress cannot complete setup if MySQL or MariaDB is unavailable.

Check versions and prerequisites first

For a new production site, WordPress currently recommends PHP 8.3 or newer, MariaDB 10.11 or newer, or MySQL 8.0 or newer, together with HTTPS. These are the current recommendations on WordPress.org’s requirements page. Older combinations such as PHP 7.4 or newer and MySQL 5.5.5 or newer may still run some WordPress releases, but WordPress identifies those versions as end-of-life; using them can leave a site exposed to known security problems.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Local development is less demanding than production, but using a current XAMPP package avoids diagnosing problems caused by obsolete PHP extensions or database behavior. Before installing, have the following ready:

  • A Windows account that can install software and start services.
  • Several hundred megabytes of free disk space for XAMPP, WordPress, themes, plugins, and test media.
  • A text editor for inspecting or editing wp-config.php.
  • A web browser.
  • No requirement for FTP. FTP is useful when transferring files to a remote host, not when the site stays on the same computer.

Record the XAMPP installation directory. The default is commonly C:xampp, but you may choose another simple path. Your web root will be the htdocs directory inside that installation, for example C:xampphtdocs.

Step 1: Install XAMPP

  1. Download the installer for your operating system from Apache Friends.
  2. Run the installer and keep Apache, PHP, the database component, and phpMyAdmin selected. Those components are the minimum set needed for this procedure.
  3. Choose an installation path that is easy to find. Avoid moving individual XAMPP components after installation; their configuration files refer to the original path.
  4. Finish the installation and open the XAMPP Control Panel.

On macOS and Linux, the names and service controls differ. Install the package intended for that operating system, then identify its equivalent web-root directory and control method before copying WordPress. Do not assume that Windows paths such as C:xampphtdocs exist on another platform.

Step 2: Start Apache and MySQL or MariaDB

In the XAMPP Control Panel, click Start beside Apache and beside MySQL (the database may be labeled MariaDB in some packages). A running module is shown as active, commonly with a green highlight and a visible process identifier.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The XAMPP handbook describes the Control Panel as the place to manually start and stop Apache and MySQL or install them as services. Installing services can make them start with Windows, but manual startup is easier to understand for a first project: start both modules when you work and stop them when you finish.

If Apache will not start

Apache normally listens on HTTP port 80. Another web server, virtualization tool, VPN component, or Windows service may already be using that port. In the Control Panel, open Apache’s Logs and inspect the error log for a bind or port message. Identify the competing program before changing settings.

  • Stop the other program temporarily if you do not need it.
  • Reconfigure the other program to use a different port.
  • Alternatively, change Apache’s listening port in its configuration and use that port in every browser address, such as http://localhost:8080/my-site/. A changed port does not change the WordPress folder; it changes only the URL used to reach Apache.

If MySQL or MariaDB will not start

Another MySQL or MariaDB service may already be running. Stop the competing service through Windows Services or its own management tool, then try the XAMPP module again. If it still fails, open the database module’s log in the Control Panel. Do not delete the database directory while troubleshooting; doing so can destroy existing local sites.

Step 3: Download WordPress and put it in htdocs

  1. Download the current WordPress package from WordPress.org.
  2. Extract the archive. It normally creates a directory named wordpress.
  3. Move that entire directory into XAMPP’s web root, usually C:xampphtdocs.
  4. Optionally rename the directory to a project-specific name such as my-site. The folder name becomes part of the local URL.

For example, these two layouts produce different addresses:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Folder on disk Browser address
C:xampphtdocswordpress http://localhost/wordpress/
C:xampphtdocsmy-site http://localhost/my-site/

Do not leave an extra archive level such as htdocswordpresswordpress unless you intend to use that second path. A 404 error often results from opening a URL that does not match the actual folder nesting.

Step 4: Create the WordPress database in phpMyAdmin

  1. Confirm that Apache and MySQL or MariaDB are running.
  2. Open http://localhost/phpmyadmin/ in your browser.
  3. Choose the option to create a new database.
  4. Enter a simple, unique name such as wordpress_local.
  5. Create the database using the default character-set and collation choices unless your project has a specific compatibility requirement.

WordPress requires MySQL or MariaDB; other database engines are not supported for a normal installation. Leave XAMPP’s system databases alone. Create a separate database for each independent WordPress site so that deleting test content from one project cannot affect another.

Database name, user, password, and host

The WordPress installer needs four values:

  • Database name: the name you created, such as wordpress_local.
  • Database user: the MySQL or MariaDB account permitted to use that database.
  • Database password: the password for that account.
  • Database host: usually localhost when the database server runs in the same XAMPP installation.

A default local XAMPP setup may use the root account, sometimes with no password, but that is not a rule. XAMPP can be secured with a password, and you may create a separate database user. Use the credentials that actually exist on your computer; never copy a blank password from an example if you have configured one.

Step 5: Run the WordPress installer

  1. Open the URL matching your folder, such as http://localhost/wordpress/ or http://localhost/my-site/.
  2. Select the installation language.
  3. When prompted, enter the database name, database username, database password, and database host.
  4. Continue to the site information screen.
  5. Set a site title, administrator username, a strong administrator password, and an email address.
  6. Submit the installation and sign in at the local dashboard URL, normally http://localhost/wordpress/wp-admin/ or the equivalent renamed-folder path.

The installer writes the connection details into wp-config.php in the WordPress installation root. Keep that file in the same directory as wp-admin, wp-content, and wp-includes. Do not paste real passwords into public screenshots, tutorials, or support posts.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Manual wp-config.php setup

If WordPress cannot create the file automatically, copy wp-config-sample.php to wp-config.php in the WordPress root and edit the database constants with a text editor. A configuration for a database named wordpress_local might contain:

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

Replace every example value with your own credentials. The username may not be root, the password may not be blank, and the host may include a nonstandard port if you deliberately configured one. Save the file exactly as wp-config.php, not wp-config.php.txt.

Step 6: Verify the local site

Sign in to the dashboard and perform a small test before building anything substantial:

  1. Change the site title under the general site settings.
  2. Activate a theme.
  3. Create and view a test page.
  4. Upload a small test image if you need to verify the media directory.
  5. Visit the front end and confirm that the browser address still begins with http://localhost/.

Keeping the address on localhost confirms that the browser is talking to your XAMPP stack rather than a public hosting account. When you are finished, stop Apache and MySQL or MariaDB in the Control Panel. Stopping the services makes the site unavailable until you start them again; it does not delete the files or database.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshoot the most common failures

“localhost” does not load

  • Check that Apache is shown as running in the XAMPP Control Panel.
  • Try http://localhost/ and inspect the Apache log if it fails.
  • Check whether Apache is listening on a different port. If it is, include that port in the address.
  • Confirm that a firewall or another local web server is not intercepting the request.

The WordPress URL returns 404 Not Found

  • Confirm that the WordPress directory is directly inside XAMPP’s htdocs web root.
  • Match the URL’s final path segment to the actual folder name, including hyphens and capitalization.
  • Check for an accidental extra directory level created during extraction.
  • Make sure Apache, not only MySQL, is running.

“Error establishing a database connection”

  • Confirm that MySQL or MariaDB is running in the Control Panel.
  • Open phpMyAdmin and verify that the database name is present.
  • Compare the database name, user, password, and host in the installer or wp-config.php with the account you actually created.
  • Use localhost as the host for a normal same-computer setup, unless you intentionally configured a different host or port.
  • Check that the account has permission to use the selected database.

A blank page or PHP error appears

Check the PHP version bundled with XAMPP against the WordPress version’s supported requirements, then inspect the Apache and PHP error logs. Do not silently mix XAMPP’s PHP with a separate PHP installation in your system path; the web request is executed by the PHP module configured for Apache. Temporarily disabling a newly added plugin or theme can help isolate an application-level fatal error, but keep a backup of the affected files before changing them.

Apache and the database use different ports or services

A port change affects how you connect, not where WordPress is stored. If Apache uses port 8080, open http://localhost:8080/my-site/. If the database server uses a custom port, include the appropriate host-and-port syntax in the database configuration supported by your WordPress and PHP versions. Record nondefault settings so you can reproduce the site on another computer.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Secure the local XAMPP installation

XAMPP is intended for development, not as a ready-to-expose public server. Its default control panel and database configuration should never be placed directly on the public internet.

  • Set a password for the MySQL or MariaDB administrative account instead of relying on an unchanged default.
  • Follow XAMPP’s security guidance to protect the XAMPP web panel and phpMyAdmin.
  • Use a strong, unique WordPress administrator password.
  • Keep Apache and the database bound to local access unless you have a specific, secured testing requirement.
  • Do not put production customer data or real user credentials into an unsecured local installation.

These precautions matter even on a shared development computer. Anyone who can access an unprotected phpMyAdmin instance may be able to read, alter, or delete local databases.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Moving from local development to production

A localhost site is not automatically ready for a public server. Before deployment, re-check WordPress’s current requirements: PHP 8.3 or newer, MariaDB 10.11 or newer or MySQL 8.0 or newer, a supported Apache or Nginx configuration, and HTTPS. A production host also needs operating-system updates, firewall rules, restricted database access, backups, least-privilege accounts, and a plan for applying WordPress, theme, and plugin security updates.

Migration normally involves exporting the local database, copying the WordPress files, changing the site’s URL and database credentials for the remote host, and testing redirects, media, permalinks, email, and HTTPS. The exact sequence depends on the destination host. Keep the local copy intact until the public site has been verified.

How XAMPP compares with other local options

XAMPP is a practical choice when you want a conventional Apache, PHP, and MySQL-style stack with a graphical control panel. Other tools can be better for particular workflows, but the right choice depends on more than the label of the package.

Decision factor XAMPP Other local options
Operating-system coverage Packages are available for Windows, macOS, and Linux, with platform-specific setup details. Coverage varies; verify that the tool supports your operating system and required PHP versions.
Version control Version choices are tied to the XAMPP package you install; changing versions may require installing another package. Some tools make switching PHP or database versions easier; others require manual configuration or separate containers.
Service management The XAMPP Control Panel starts and stops Apache and MySQL or MariaDB through a GUI. Some alternatives use a GUI, while Docker-based setups are commonly managed from a command line and configuration files.
Multiple WordPress sites Each site can live in its own htdocs subfolder and database, but you manage names, ports, and settings yourself. Some tools automate site creation, local domains, and per-site PHP versions.
Production similarity Useful when your intended host uses a familiar Apache/PHP/MySQL combination. Containers or a host-specific stack may reproduce a particular production environment more closely.
Backup and migration You must export databases and copy files using your chosen workflow. Some alternatives add import/export helpers; check exactly what they include before relying on them.

Switching tools does not remove the underlying WordPress requirements: the application still needs PHP, a supported MySQL-compatible database, a web server, and correctly matched credentials.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A repeatable checklist for every new local site

  • Install a current XAMPP package and note its installation path.
  • Start Apache and MySQL or MariaDB in the Control Panel.
  • Place one WordPress directory directly under htdocs.
  • Create a separate database in http://localhost/phpmyadmin/.
  • Open the URL that matches the folder name.
  • Enter the real database name, user, password, and host.
  • Save or verify wp-config.php in the WordPress root.
  • Test the dashboard, front end, theme, and a page while the address remains on localhost.
  • Stop the services when finished and protect the XAMPP panel and database accounts.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.