Skip to main content

Custom Web Development Services

How to Install WordPress on Localhost

To install WordPress on localhost, you need a web server, PHP and a MySQL-compatible database running on your own computer. The fastest route is a one-click tool such as LocalWP or WordPress Studio, which sets everything up in a few minutes. If you want to understand every moving part, use XAMPP: start Apache and MySQL, create a database in phpMyAdmin, copy WordPress into the htdocs folder, and run the installer at localhost.

This guide covers both methods on Windows and Mac, the settings that trip people up, and how to fix the five errors that stop most local installs.

Why install WordPress locally?

A local WordPress install runs only on your machine, so nothing you change is visible on the internet. It costs nothing, works offline, and lets you test themes, plugins, PHP versions and code changes without risking a live site.

Developers use local sites for building themes and plugins. Site owners use them to test a major update or redesign before touching production. Learners use them to explore WordPress without paying for hosting.

Which local setup should you use?

Pick the tool based on what you’re trying to do, not on which one is most popular.

Tool Best for Setup time Platforms
WordPress Studio Beginners; fastest possible install A few minutes Windows, Mac
LocalWP Most users; multiple sites, switching PHP versions, SSL A few minutes Windows, Mac, Linux
XAMPP (manual) Learning how WordPress, PHP and MySQL fit together 15–20 minutes Windows, Mac, Linux
Docker / wp-env Developers matching production or working in teams 5–15 minutes if Docker is installed Windows, Mac, Linux
WordPress Playground Quick tests in the browser, no install at all Seconds Any browser

If you just need a working site today, use Studio or LocalWP. If you’re learning or need full control over Apache and PHP settings, use XAMPP.

Before you start: match your host’s versions

WordPress.org currently recommends PHP 8.3 or newer and MariaDB 10.11+ or MySQL 8.0+. WordPress will still run on PHP 7.4, but that version is past end of life.

The more useful rule is to match your local PHP version to the one your live host runs. A plugin that works on PHP 8.3 locally can fail on a host still running 8.1, and you’ll only find out after deploying. Check your live site’s version under Tools → Site Health → Info → Server.

WordPress installer database connection screen on localhost

Method 1: Install WordPress with LocalWP or Studio (quickest)

One-click tools bundle the server, PHP and database for you and run the WordPress installer in the background.

Using LocalWP

  1. Download LocalWP from its official site and run the installer.
  2. Open the app and click + (Create a new site).
  3. Enter a site name, for example “client-redesign”. LocalWP gives it a local domain such as client-redesign.local.
  4. Choose Preferred environment, or Custom to pick a specific PHP version, web server (nginx or Apache) and MySQL version that match your host.
  5. Set a WordPress admin username, password and email.
  6. Click Add Site, wait for setup to finish, then click WP Admin to log in.

LocalWP also gives you one-click SSL for the local domain, a database viewer, and a shortcut to open the site folder in your code editor.

Using WordPress Studio

  1. Download Studio for Mac or Windows from WordPress.com and install it.
  2. Click Add site, name it, and confirm.
  3. Once the site status shows it’s running, click WP Admin.

Studio has fewer settings than LocalWP, which is the point: it’s the shortest path to a working local site.

XAMPP Control Panel with Apache and MySQL running

Method 2: Install WordPress on localhost with XAMPP

XAMPP bundles Apache (web server), MariaDB (a MySQL-compatible database, still labelled “MySQL” in the panel), PHP and phpMyAdmin. Here’s the full manual process.

Step 1: Install XAMPP and start the services

  1. Download XAMPP from Apache Friends. Pick a version whose PHP release is close to your host’s.
  2. Run the installer. On Windows, install to C:\xampp, not inside Program Files, to avoid permission problems.
  3. Open the XAMPP Control Panel and click Start next to Apache and MySQL. Both should turn green.
  4. Visit http://localhost in your browser. The XAMPP dashboard means the server is working.

Creating a WordPress database in phpMyAdmin with utf8mb4_unicode_ci collation

Step 2: Create a database

  1. Go to http://localhost/phpmyadmin.
  2. Click Databases.
  3. Enter a name, for example wp_local, and choose the utf8mb4_unicode_ci collation so emoji and non-Latin characters store correctly.
  4. Click Create.

Step 3: Copy WordPress into htdocs

  1. Download the latest WordPress zip from wordpress.org/download.
  2. Extract it. You’ll get a folder called wordpress.
  3. Move it into the XAMPP htdocs folder (C:\xampp\htdocs on Windows, /Applications/XAMPP/htdocs on Mac) and rename it, for example mysite.

The folder name becomes part of your local URL: http://localhost/mysite.

Step 4: Run the WordPress installer

  1. Visit http://localhost/mysite.
  2. Choose your language and click Let’s go.
  3. Enter the database details:
Field Value on a default XAMPP install
Database name wp_local (the one you created)
Username root
Password leave blank
Database host localhost
Table prefix wp_ (change it if you’ll run several sites in one database)
  1. Click Submit, then Run the installation.
  2. Enter a site title, admin username, a strong password and your email, then click Install WordPress.
  3. Log in at http://localhost/mysite/wp-admin.

A root user with no password is acceptable only because XAMPP is running on your own machine and isn’t exposed to the internet. Never copy those database credentials to a live server.

How to fix common localhost WordPress errors

Most failed local installs come down to five problems.

Apache won’t start (port 80 or 443 already in use)

Another program is using the port. On Windows, common culprits are IIS, the World Wide Web Publishing Service, or other local server software. Either stop that program, or change Apache’s port: in XAMPP, click Config → httpd.conf, change Listen 80 to Listen 8080, save, and restart Apache. Your site then lives at http://localhost:8080/mysite.

MySQL won’t start (port 3306 in use)

Usually another MySQL instance or a previous XAMPP install is still running. Stop the other service, or change the port in my.ini and add the port to the database host in wp-config.php, for example localhost:3307.

“Error establishing a database connection”

WordPress can’t reach the database. Check that MySQL is running in the Control Panel, then check the database name, username, password and host in wp-config.php. A single typo in the database name causes this error.

Permalinks return 404 errors

Pretty permalinks need Apache’s mod_rewrite and a writable .htaccess file. Go to Settings → Permalinks and click Save Changes to regenerate .htaccess. On XAMPP, mod_rewrite is normally enabled; if not, uncomment the LoadModule rewrite_module line in httpd.conf.

“The uploaded file exceeds the upload_max_filesize directive”

PHP’s default upload limit is too small for many themes and plugins. Open php.ini (Config → PHP (php.ini) in XAMPP) and raise upload_max_filesize and post_max_size, for example to 64M, then restart Apache.

Moving your local site to a live server

When the site is ready, you need to move both the files and the database, and update every URL from localhost to your real domain.

The simplest route is a migration plugin: export the site as a package locally, then import it on the live WordPress install. The plugin handles the search-and-replace of URLs, including serialised data, which a plain text find-and-replace in the SQL file can break.

Doing it manually works too: upload the files via SFTP, export the database from phpMyAdmin, import it on the host, update wp-config.php with the live database details, and run a search-replace with WP-CLI.

If you’d rather not handle migrations yourself, our team can take a site from local to live, including redirects, SSL and caching. See our WordPress development services.

Next steps after installing

Once your local site is running:

  1. Set Settings → Reading → Discourage search engines on any site that might later be cloned to a public server.
  2. Install only the theme and plugins you’d actually use live, so your tests reflect production.
  3. Use a child theme or a custom theme for code changes, never edits to a parent theme.
  4. Put your theme or plugin code under Git from day one.

If you’re deciding whether WordPress is the right platform for your next project at all, read WordPress vs a custom-coded website. Planning a professional build instead of a DIY one? Here’s what WordPress development costs.

FAQs

Can I install WordPress on localhost without XAMPP?

Yes. LocalWP and WordPress Studio install everything for you, Docker-based tools suit developers, and WordPress Playground runs WordPress in your browser with no install.

What is the default username and password for a local WordPress install?

There isn’t one. You set the admin username and password during installation. On a default XAMPP setup, the database user is root with no password, which is separate from your WordPress login.

Is a localhost WordPress site visible to other people?

No. It runs only on your computer. To show it to someone, you need a sharing feature in your local tool, a temporary tunnel, or to move it to a staging server.

Can I install multiple WordPress sites on localhost?

Yes. In XAMPP, create a separate folder and database for each site. LocalWP and Studio let you add as many sites as you like from the app.

Leave a Reply

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