How to Install WordPress on Localhost Step‑by‑Step (Beginner Guide 2026)

Preview image.

Testing new features or plugins directly on a live website is risky. A single buggy line of code can break your entire site, lock out visitors, and even trigger costly downtime.

Most professionals use a staging environment, which is a copy of the production server that mirrors everything except the live traffic. However, staging servers often come with extra costs or limited resources, and sometimes you’re not sure whether the new change is safe enough to test there.

That’s where running WordPress on localhost really stands out. You’re working with a fully functional website that runs entirely on your own computer, completely isolated from your live public domain and not accessible from the internet. If something goes wrong, just delete the local installation and start fresh, without impact on your live data or revenue.

Below you’ll find a step-by-step, beginner‑friendly guide to installing WordPress on Windows using MariaDB, PHP, Apache , HeidiSQL, and WordPress. By the end, you’ll have a local copy of WordPress up and running in no time.

Step 1: Install MariaDB

Why we need it: MariaDB stores your WordPress site’s data (like posts and settings) locally on your computer, providing the database backend that WordPress requires.

  1. Go to https://mariadb.org/download/ and click the Download button.
MariaDB download link.
  1. Run the downloaded installer file mariadb-12.2.2-winx64, or whichever version you downloaded.
  2. Click Next until you reach the User settings section.
  3. Enter a secure password for the root user and remember it, you’ll need it later.
MariaDB installation auth.
  1. Click Next, leave all remaining settings at their default values, and complete the installation.

Step 2: Install PHP

Why we need it: PHP is needed because WordPress is built with it, so it runs the code that generates your website on your local machine.

  1. Go to https://windows.php.net/download/.
  2. Under PHP 8.5 (8.5.4) or whichever version is current for you, download the VS17 x64 Thread Safe ZIP package.
PHP download link.
  1. Extract the zip you downloaded (php-8.5.4-Win32-vs17-x64.zip) to C:\PHP
  2. Inside the C:\PHP folder, copy the php.ini-development file and paste it in the same folder.
php ini development file.
  1. Rename it to php.ini. Windows may warn that changing the file extension could make it unusable. Click Yes to continue.
PHP Ini file rename warning.
PHP Ini file renamed.
  1. Open php.ini in a text editor.
  2. Uncomment the line extension_dir = "ext" by removing the leading semicolon (;) and set it to the full path: extension_dir = "C:/PHP/ext".
extension_dir ini line.
  1. Uncomment the line extension=curl.
extension_curl ini line.
  1. Uncomment the line extension=gd.
extension_gd ini line.
  1. Uncomment the line extension=mbstring.
extension_mbstring ini line.
  1. Uncomment the line extension=mysqli.
extension_mysqli ini line.
  1. Uncomment the line extension=pdo_mysql.
extension_pdo_mysql ini line.
  1. Uncomment the line extension=openssl.
extension_openssl ini line.
  1. Save the file.

Step 3: Install Apache HTTP Server

Why we need it: Apache is a web server that runs on your computer, letting you serve and view your WordPress site locally.

  1. Go to https://www.apachelounge.com/download/.
  2. Click the Win64 link to download the file, for example, httpd-2.4.66-260223-Win64-VS18.zip, or whichever version is currently available. 
Download Apache.
  1. Extract the zip into C:\Apache24. The files will land in C:\Apache24\Apache24.
Apache folder structure.
  1. Open the file C:\Apache24\Apache24\conf\httpd.conf in a text editor.
  2. Set the line SRVROOT to "C:/Apache24/Apache24".
SRVROOT conf line.
  1. Uncomment the line LoadModule rewrite_module modules/mod_rewrite.so by removing the trailing pound (#) character.
mode_rewrite conf line.
  1. Find all occurrences of AllowOverride None and change them to value to AllowOverride All. In this version of Apache there are 3 instances that need to be changed as shown below.
AllowOverride conf line.
AllowOverride conf line.
AllowOverride conf line.
  1. Uncomment the line LoadModule access_compat_module modules/mod_access_compat.so if not uncommented already.
mod_access_compat conf line.
  1. Search for DirectoryIndex index.html and replace it with DirectoryIndex index.php index.html.
DirectoryIndex conf line.
  1. At the end of the file, paste this snippet of code. Make sure the paths are pointing to the right location.

# PHP module
LoadModule php_module "C:/PHP/php8apache2_4.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/PHP"

PHP module.
  1. Now to test that the server is working, create a new file called index.php and save it inside the C:\Apache24\Apache24\htdocs folder. htdocs is the root folder where you put your WordPress website files.
index.php file.
  1. Open the index.php file in a text editor and paste the code below. This line of PHP displays detailed information about your PHP setup such as version, installed extensions, configuration settings, and server environment. It’s a useful way to test that the server is working.
<?php phpinfo(); ?>
  1. Save the file.
  2. Navigate to C:\Apache24\Apache24\bin folder and double-click httpd.exe to start the server. Windows might try to prevent you from running the file. If that’s the case, click More info then click Run anyway.
Windows warning 1.
Windows warning 2.

A blank Command Prompt window (as shown below) should appear and remain open. If it closes immediately, something went wrong. In that case, go back to step 2 to double-check the php ini file for any mistakes or missing changes, and also review the configuration settings we’ve just made in step 3 to ensure everything is correct.

Apache server window.

Useful Tip

If you want to see any errors, run httpd.exe from the Command Prompt instead of double-clicking it. Double-clicking closes the window immediately on error, so running it in the terminal lets you read the error messages.

  1. Open a browser and go to http://localhost/. If everything is working correctly, a window should appear displaying all your PHP and server settings. This happens because the index.php file we created earlier outputs this PHP information. Congratulations, Apache is working! You can now shut down the server by closing the httpd.exe window.
PHP test window.

Step 4: Set Up HeidiSQL

Why we need it: HeidiSQL is a database management tool that lets you view, edit, and manage your WordPress database easily.

  1. Open HeidiSQL, which was installed automatically with MariaDB in step 1. You can find its icon on the desktop, or search for “HeidiSQL” on your computer if it’s not there.
HeidiSQL icon.
  1. Create a new connection by pressing the green New button at the bottom left.
Create new database.
  1. Name the connection localhost.
localhost name.
  1. Set the Hostname / IP to 127.0.0.1. This IP address is the loopback IP address that points to your own computer, often called localhost, allowing your machine to connect to services running on itself.
Hostname / IP.
  1. Set the User to “root” and the Password to the same password you created when you installed MariaDB in step 1 part 4.
Login to database.
  1. Click Open to open the connection.
Open button.
  1. Create a database by right-clicking localhost –> Create new –> Database.
Create new database.
  1. Give your database a name. We will call it wp_tutorial_db.
  2. Set the Collation to utf8mb4_unicode_520_ci.
Enter database details.
  1. Click OK.
  2. Click the Manage user authentication and privileges (icon with 2 heads), in the top bar menu to open the UserManager.
User management button.
  1. Click the Add button in the top left of the window to create a new user.
Add new user.
  1. Set the Username to anything you like. We will set it to wp_tutorial_user.
  2. Set From host to localhost.
  3. In the Password field, enter a password of your choice and make sure to remember it. You will need it later when installing WordPress.
New user authentication.
  1. If it isn’t already unchecked, disable Global privileges to limit the user’s access to only what’s necessary, rather than granting full control over the entire server.
Remove global privileges.
  1. Click Add object.
Add object.
  1. Select the database you just created or wp_tutorial_db if you followed our naming convention.
Newly created database.
  1. Click OK.
  2. Check the checkbox next to the new object we created Database:wp\_tutorial\_db to give it global privileges. We grant the user global privileges for the database so WordPress can read, write, and modify data like creating tables, saving posts, and updating settings.
Add database privileges.
  1. Click Save.
Save user.

Step 5: Install WordPress

  1. Delete all the files in the C:\Apache24\Apache24\htdocs since we don’t need the test files anymore.
Removed files from htdocs.
  1. Go to https://wordpress.org/download to get the latest WordPress.
  2. Click Download WordPress 6.9.4, or whatever the current version is for you.
WordPress download link.
  1. When the download is done, extract the files anywhere temporarily.
  2. After extracting, it will create a wordpress-6.9.4 folder, or whatever your version is, with a wordpress subfolder inside it.
  3. Copy all contents of that inner wordpress folder and paste them in C:\Apache24\Apache24\htdocs.
WordPress files in htdocs.
  1. Run the Apache server by executing the C:\Apache24\Appache24\bin\httpd.exe as we did earlier.
  2. In your browser, open the link http://localhost. The WordPress installation wizard should appear.
WordPress installation wizard.
  1. Choose English (United States), or whatever language you prefer, and press Continue.
  2. Some information about wp-config.php will be displayed. Click Let’s Go!
Click Let's go.
  1. Set Database Name to the database you created earlier in HeidiSQL in step 4, or wp_tutorial_db if you followed our naming convention.
  2. Set Username to the user you created earlier in step 4, or wp_tutorial_user if you followed our naming convention.
  3. Set Password to the one gave to the user in step 4.
  4. Leave Database Host to localhost and Table Prefix to wp_.
  5. Click Submit.
Database credentials.
  1. If you entered the correct credentials and everything went well, you should see the window with the Run the installation button. Click the Run the installation button.
Run the installation.
  1. It will now ask you to enter some information about your site. Site Title is the title of your site. You can set it to anything you like.
  2. Username is what you’ll use to log in to WordPress as an administrator. This is separate from the database user you created earlier in HeidiSQL. You can choose any username you like. For this example, we’ll use wp_tutorial_user_2. Make sure to remember this username, as you’ll need it to log in to WordPress later.
  3. The Password is what you’ll use to log in to WordPress as an administrator. Choose a strong, secure password and remember it. You’ll need it to log in to WordPress later.
  4. You can set Email it to any email you like.
  5. Search engine visibility tells web crawlers if you want your website to be indexed or not. Since you’re on localhost, then this setting does not matter. Crawlers cannot reach it and therefore cannot index it anyways. Leave it unchecked.
  6. Click Install WordPress.
Site details.
  1. If everything is set up correctly, you should see a confirmation window indicating that the installation was successful.
  2. Click the Log in button.
Successful WordPress installation.
  1. Enter the username and password you just created.
  2. Click Log In.
WordPress login page.
  1. Now you should be logged in as admin.
Finished WordPress installation.

Congratulations! You have finished installing WordPress on you local machine 🎉.

Useful Tips

  • Cloning a Real Site: If you want to mirror your production website locally, use the Duplicator plugin or a similar tool.
  • Security Reminder: The file C:\Apache24\Apache24\htdocs\wp-config.php contains database credentials in plain text. Never share it publicly.
  • Stopping Apache: When you’re done, close the httpd.exe window (or press Ctrl+C if you launched it from a command prompt) to shut down the server.
  • Backups: Keep a copy of your entire htdocs folder after installing a fresh WordPress. This way you can restore or recreate WordPress quickly without starting over in case something gets messed up.

Conclusion

Setting up a localhost WordPress site is quick, cost‑free, and gives you absolute control. You can experiment with new features, plugins, or design changes without risking your live site. If something goes wrong, just delete the local folder and start fresh. Happy developing!

Support Us

If you found this blog helpful, please consider supporting us by visiting the Support Us page. Every contribution makes a difference.

Leave a Comment

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

Scroll to Top