Get it working offline before you upload
One of the best ways to test a new website you’re developing is by installing a WordPress test site on your computer. Test it locally, make sure everything looks and works good, and then upload it to the live site all at once.
When it comes to WordPress, there are several things to consider when running locally. You’ll need a working WordPress installation, an available SQL database, and a local web server for everything to run on.
You can set up all three on your local computer without too much effort, using the process outlined below.
Install a Local Web Server
The first thing you’ll need to run a local WordPress test site is a web server running on your local computer. Running a web server involves ensuring the right ports are running, PHP and Perl programming languages libraries are installed, and that the web server software can properly serve pages to your browser.
Similar to setting up an FTP server or a local Minecraft server, there are Windows applications available to run a local web server as well. One of the most popular of those is XAMPP.
XAMPP is an open-source Apache web server you can install on Windows 10, Linux, or macOS. It includes everything you need all in one package.
To get started, just download and install the XAMPP software to your desktop or laptop PC.
1. Run the installer, make sure all components are enabled, and select Next to continue.
2. Choose a location for your web server. The best option is to choose the default folder at the root of the C: drive where permissions will be set properly. Select Next to continue.
3. Select your languages and select Next. Keep Bitnami enabled, which will help you with installing WordPress after installation. Select Next. Finally, select Next one more time to install XAMPP.
Installation will take about five minutes. Once finished, the XAMPP control panel will open. Close it for now.
Install WordPress on Your XAMPP Web Server
Launch the control panel again as admin by selecting Start, typing XAMPP, right-clicking the XAMPP application and choosing Run as administrator. You may need to confirm when Windows asks if you want the application to run with admin rights.
Once it launches, select Start to the right of Apache and MySQL to launch the web server and the SQL database needed for your WordPress test site to work properly.
You can see the web server’s file structure by looking at the location where you’ve installed XAMPP. In this example, XAMPP is installed in C:\XAMPP. This is where all of your web files will go that’ll be viewable from your web browser.
XAMPP comes with Bitnami, which lets you quickly install WordPress on top of your current XAMPP web server.
1. Open a web browser and type localhost in the URL field. Press Enter. When the XAMPP dashboard comes up, scroll down to the bottom of the page where you’ll see the Bitnami section.
2. Select the WordPress icon at the bottom of the page. On the Bitnami site, scroll down to the WordPress section and select the Windows link to download WordPress.
3. Once the download is complete, double-click the file to launch the installation package. Select Next as needed to step through the Bitnami WordPress Module. Make sure the folder specified for installation matches that of the XAMPP installation.
4. On the next step, configure the Admin login, name, email address, and password that you want to use with your WordPress test site.
5. Select Next when you’re done, type a name for the WordPress test site and select Next. On the next page, you can configure email support so your test site can send notifications to your email. This is optional.
6. You can deselect Launch wordpress in the cloud with Bitnami since this will just be a local WordPress test site on your computer. Select Next to continue. Select Next again to initiate the installation. Once the installation is done, select Finish to launch the Bitnami WordPress module.
This will launch your default web browser with your new local WordPress test site loaded. The link will include your localhost IP address (your computer’s IP address), with /wordpress/ at the end, where your site is stored.
The path to these WordPress files is C:\XAMPP\apps\wordpress\htdocs\
Now you’re ready to configure your WordPress test site and start using it.
Using Your WordPress Test Site
To access your local WordPress admin page, type http://localhost/wordpress/wp-admin into the browser URL field and log into WordPress using the credentials you set up during the WordPress installation above.
There are a few things you can do with this new local WordPress test site.
Import a Copy of Your Live Site
You could export your actual online website and load it into this installation for testing.
To do this, you’ll need to backup your WordPress site and WordPress database. This will provide you with a zipped folder with all of the WordPress files, as well as a *.gz file which is the backup of your mySQL database.
You can copy the backed up WordPress files directly into your local WordPress folders. You can also import your mySQL *.gz database file into your local mySQL database using phpMyAdmin.
1. Open phpMyAdmin by visiting http://localhost/phpmyadmin/ with your browser.
2. Select the Import tab, and select the Choose File button under File to import.
3. Browse to your backed up *.gz database file and phpMyAdmin will import all posts and WordPress settings into your test WordPress site.
Once you’re done and you reopen the local WordPress installation using the same link as above, you’ll see your original online site now running on your local computer.
Other Things You Can Do With a WordPress Test Site
In addition to running your live site on your local machine, there are a lot of other useful things you can do with your local WordPress test site.
- Install and test any WordPress theme
- Test making code changes to your WordPress site
- Install and test WordPress plugin configurations
- Play around with WordPress configurations to see how it changes your site
You can do all of these things in the safety of your local WordPress test site because every change you make only happens on your computer, rather than the web.