
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.
- Go to https://mariadb.org/download/ and click the Download button.
- Run the downloaded installer file mariadb-12.2.2-winx64, or whichever version you downloaded.
- Click Next until you reach the User settings section.
- Enter a secure password for the root user and remember it, you’ll need it later.

- 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.
- Go to https://windows.php.net/download/.
- Under PHP 8.5 (8.5.4) or whichever version is current for you, download the VS17 x64 Thread Safe ZIP package.

- Extract the zip you downloaded (php-8.5.4-Win32-vs17-x64.zip) to C:\PHP.
- Inside the C:\PHP folder, copy the php.ini-development file and paste it in the same folder.

- Rename it to php.ini. Windows may warn that changing the file extension could make it unusable. Click Yes to continue.
- Open php.ini in a text editor.
- Uncomment the line
extension_dir = "ext"by removing the leading semicolon (;) and set it to the full path:extension_dir = "C:/PHP/ext".

- Uncomment the line
extension=curl.

- Uncomment the line
extension=gd.

- Uncomment the line
extension=mbstring.

- Uncomment the line
extension=mysqli.

- Uncomment the line
extension=pdo_mysql.

- Uncomment the line
extension=openssl.

- 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.
- Go to https://www.apachelounge.com/download/.
- Click the Win64 link to download the file, for example, httpd-2.4.66-260223-Win64-VS18.zip, or whichever version is currently available.
- Extract the zip into C:\Apache24. The files will land in C:\Apache24\Apache24.

- Open the file C:\Apache24\Apache24\conf\httpd.conf in a text editor.
- Set the line
SRVROOTto"C:/Apache24/Apache24".

- Uncomment the line
LoadModule rewrite_module modules/mod_rewrite.soby removing the trailing pound (#) character.

- Find all occurrences of
AllowOverride Noneand change them to value toAllowOverride All. In this version of Apache there are 3 instances that need to be changed as shown below.



- Uncomment the line
LoadModule access_compat_module modules/mod_access_compat.soif not uncommented already.

- Search for
DirectoryIndex index.htmland replace it withDirectoryIndex index.php index.html.

- 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"

- 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.

- 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(); ?>
- Save the file.
- 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.
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.
- 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.

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.
- 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.

- Create a new connection by pressing the green New button at the bottom left.

- Name the connection localhost.

- 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.

- Set the User to “root” and the Password to the same password you created when you installed MariaDB in step 1 part 4.

- Click Open to open the connection.

- Create a database by right-clicking localhost –> Create new –> Database.
- Give your database a name. We will call it wp_tutorial_db.
- Set the Collation to utf8mb4_unicode_520_ci.

- Click OK.
- Click the Manage user authentication and privileges (icon with 2 heads), in the top bar menu to open the UserManager.
- Click the Add button in the top left of the window to create a new user.

- Set the Username to anything you like. We will set it to wp_tutorial_user.
- Set From host to localhost.
- In the Password field, enter a password of your choice and make sure to remember it. You will need it later when installing WordPress.

- 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.

- Click Add object.

- Select the database you just created or wp_tutorial_db if you followed our naming convention.

- Click OK.
- 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.

- Click Save.

Step 5: Install WordPress
- Delete all the files in the C:\Apache24\Apache24\htdocs since we don’t need the test files anymore.

- Go to https://wordpress.org/download to get the latest WordPress.
- Click Download WordPress 6.9.4, or whatever the current version is for you.
- When the download is done, extract the files anywhere temporarily.
- After extracting, it will create a wordpress-6.9.4 folder, or whatever your version is, with a wordpress subfolder inside it.
- Copy all contents of that inner wordpress folder and paste them in C:\Apache24\Apache24\htdocs.

- Run the Apache server by executing the C:\Apache24\Appache24\bin\httpd.exe as we did earlier.
- In your browser, open the link http://localhost. The WordPress installation wizard should appear.
- Choose English (United States), or whatever language you prefer, and press Continue.
- Some information about wp-config.php will be displayed. Click Let’s Go!

- Set Database Name to the database you created earlier in HeidiSQL in step 4, or wp_tutorial_db if you followed our naming convention.
- Set Username to the user you created earlier in step 4, or wp_tutorial_user if you followed our naming convention.
- Set Password to the one gave to the user in step 4.
- Leave Database Host to localhost and Table Prefix to wp_.
- Click Submit.

- 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.

- 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.
- 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.
- 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.
- You can set Email it to any email you like.
- 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.
- Click Install WordPress.

- If everything is set up correctly, you should see a confirmation window indicating that the installation was successful.
- Click the Log in button.

- Enter the username and password you just created.
- Click Log In.

- Now you should be logged in as admin.
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.












