Have you ever wanted to run WordPress offline?
Imagine a scenario where you have WordPress installed on your desktop & you can use it for multiple purposes like:
- Testing themes.
- Customizing themes locally.
- Testing/developing plugins.
- Writing posts disconnected from the internet.
There are many more situations where having an offline installation of WordPress is helpful. As far I know, most of the developers use offline WordPress as a testing environment.
If you are a beginner and looking forward to having an offline installation of WordPress on your Windows-based desktop or laptop, this is a step by step tutorial for you.
For this tutorial, I will be using XAMPP, which in layman’s language is something that lets you create a web server on your local machine.
Just to clarify, the term “local host” is synonymous to “Windows desktop/laptop”.
In the following tutorial, I will show you how to install XAMPP first & then how to set up WordPress. By the end, you will have WordPress up & running on your Windows System.
The following things will be covered in this mega tutorial:
- How to download and install XAMPP on Windows.
- How to set up a MySQL Database.
- How to download and install WordPress on XAMPP.
Goal: To have WordPress up & running on Windows for offline usage.
Before we move on, let’s first understand about XAMPP and WordPress.
XAMPP enables the desktop to run web services such as PHP and MySQL which are the required components for running WordPress. In simple words, it enables all the necessary components that require running WordPress on your local machine.
XAMPP stands for cross-platform (X), Apache, MySQL, PHP, and PERL. Apart from Windows, it also works on other desktop OSs such as Linux & Mac.
WordPress is the most popular CMS (content management system) out there.
According to a recent survey, WordPress is powering more than 27% of websites in the world. It’s completely free to use, secure, available in different languages, and offers powerful features like responsive mobile sites, SEO friendliness, media management, customizable designs, high security, etc.
You can learn more about WordPress in our earlier guide: What is WordPress?
Let’s begin with the process.
Installing XAMPP on Windows: Run WordPress Locally
- First, download XAMPP. The software is 109 MB.
- Launch the installer.
- You will see a pop-up with a warning message whether you want to run the software or not. Click “YES” and proceed further.
- Click “Next” to run the XAMPP setup.
- Select the components that you want to install along with XAMPP. By default, all the options are checked. Just in case you don’t need some, you can uncheck them.
- Click “Next” to proceed.
- Select the installation folder where you want to keep XAMPP. By default, it will be installed in the C drive.
- Click “Next” to proceed.
- Click “Next” again.
- You will see a screen that says XAMPP is ready to install.
- Click “Next” to proceed further.
- This will begin the XAMPP installation. Wait for a moment and let the installation process finish.
- Your windows firewall might ask for permission. If you see a screen like the one shown below, click on “Allow access” to the Apache HTTP Server.
- This will finish up the XAMPP installation process.
- Click “Finish”.
- Select the language in the next step and click “Save”.
- This will launch the XAMPP Control Panel.
Bingo! You have successfully installed XAMPP on your local machine, and both Apache and MySQL are running successfully.
- Type “http://localhost” in your browser to confirm that XAMPP is installed on your machine. You will see something like this:
How To Set Up MySQL Database For WordPress
Before installing WordPress, we need to set up the database.
- Click the “Admin” option in the XAMPP Control Panel.
- This will redirect you to http://localhost/phpmyadmin (phpMyAdmin Interface) in your browser.
- Go to “Databases” and create a new table.
- Name it anything you like and click “Create”. I called mine “wordpress”.
How To Download and Install WordPress on XAMPP
Time to install WordPress on XAMPP. To do this, head over to WordPress.org.
- Click “Download WordPress”.
- You will be redirected to the next page where you can download the latest version of WordPress.
- WordPress will be downloaded in a zip format. To run WordPress on XAMPP, you need to unzip the WordPress zip file under the XAMPP folder. To do this, go to the XAMPP folder on your computer and open the htdocs folder. (Path would be C:/XAMPP/htdocs) and unzip WordPress there.
- Open the WordPress folder and find the wp-config-sample.php file and rename it to “wp-config.php “
(just right click on the file and rename it).
- Open the wp-config file in a text editor. In my case, I’m using Notepad++.
- Scroll down until you find these lines:
The above lines of code will define the login details for your database. Let’s replace those lines with the following:
- Replace database_name_here with the name of your database, which in this case is wordpress.
- Replace username_here with root.
- Leave the password_here as blank.
Once you make the above changes, your wp-config file will look like this:
- Just save the file.
- Type http://localhost/wordpress/ in your browser.
This is where the fun part begins. You will see the translation screen from where you can select your desired language for WordPress.
- Click “Continue”.
- In the next step, fill out your database, username, and click “Submit”.
This will be same as what we did with the wp_config file:
- Database name: wordpress
- Username: root
- Password: (leave blank)
- Run the WordPress installation now.
- Set up your Site Title, Username, Email, and Password and click “Install WordPress”.
That’s it! You have successfully installed WordPress on XAMPP (on your local machine).
Now you will be redirected to the login page. Just log in with your credentials and play around!
Once you are logged in, you will see the WordPress Dashboard:
Well, now it’s up to you.
You can do anything you want like the stuff I mentioned at the start of this guide. You can also make a copy of your live site on your localhost for testing. For this, you can use the Duplicator plugin. Or you can use it to learn about WordPress.
Here are some tutorials that you can follow to make the most out your local WordPress installation:
I hope the above step-by-step guide helps you to run WordPress locally on Windows. If you have any questions or doubts, just post in the comments section, and I will surely help.
If you like the post, do share it with your friends and help them to learn WordPress!