I’ve got a confession to make. Although I’ve been using WordPress for a good few years now, and over the past year have used the software almost every day, I’ve only very recently setup a local installation of WordPress. To make matters worse, I even used to use XAMPP many years ago when I used to make traditional websites using php.
After finally getting around to installing XAMPP again and creating a local, offline version of WordPress, I thought it would be a good time to write a post convincing others to do the same. So in this post, as well as demonstrating how quickly and easily it can be done, I will also share some reasons why you might want to do this.
Why Install WordPress on your Computer?
Before getting to the ‘how’, let’s take a quick look at the ‘why’. Prior to setting up a local WordPress site by installing the software on my computer, I was using subdomains on an old domain I had registered but no longer used. This was used for testing out WordPress themes, plugins, and tweaks.
Fast File Transfer
While this worked fine most of the time, it did involve a lot of uploading files, including individual theme files, plugins, and entire themes. This often slowed things down unnecessarily, especially compared to how easy you can copy, paste, and extracted a zip file from one part of your computer to another.
By setting up a local test version of WordPress, you can move files around, make changes to WordPress, and install themes and plugins, all without virtually any page load times to slow you down.
Experiment and Learn WordPress
If you are just starting out with WordPress and learning the ropes, then creating an offline, local installation gives you a safe environment to experiment with, without having to worry about anyone seeing your attempts.
Develop Offline Before Uploading Changes
I’m sure all developers already have at least one local WordPress website at their disposal. However, if you are just getting started with WordPress design or development then the fact that you can quickly download an entire site to your computer and edit it from there might be of interest. Once you are done, it can be uploaded to overwrite the existing version with your improvements.
Create a Private Offline Blog
A further reason to create a local offline WordPress site could be if you wanted to keep a private journal. This would give you access to all the great features of WordPress, including all the plugins available for the platform, without the chance of anyone ever stumbling upon it online.
As you can see there are plenty of good reasons why you should install WordPress on your computer, so let’s find out how you can do this for free.
Installing WordPress Locally with XAMPP
In order for WordPress to be able to run on your computer, you first need to install a free piece of software called XAMPP. This is a PHP development environment, and while there are other options for creating an environment to run WordPress locally, this is as good a choice as any.
Step 1: Download XAMPP
This software can be downloaded from here so just choose the appropriate version depending on your computer’s operating system and then download the file.
Step 2: Install XAMPP
Once the file has been downloaded, double click on it to start the installation. If asked ‘whether you want to run this file’, click ‘Run’.
During the installation, leave the default component settings as is and click on ‘Next’.
When it comes to selecting a folder to install XAMPP in, you can either use the default location, or enter a new folder or drive to install XAMPP on. If in doubt, then the default location is the best option.
Then it’s just a case of waiting for XAMPP to install, before we can move onto the next step.
Step 3: Start XAMPP
Once XAMPP has installed on your computer, choose to start the Control Panel now, and click ‘Finish’.
Then once the XAMPP control panel is loaded, click on the ‘Start’ buttons for Apache and MySql.
At this stage it is common to get a security alert from Windows and its nothing to worry about. Just make sure you click on ‘Unblock’ and your local XAMPP server will now be ready to use.
To test that all is well, open your web browser and enter this URL: http://localhost
If XAMPP is setup and running correctly then you should see a page similar to this in your browser:
Step 4: Create a Database for WordPress
As WordPress uses a database we need to create one before installing WordPress. This is very straightforward and only involves a few steps.
To get started, switch back to the XAMPP control panel, and click on the ‘Admin’ button next to the ‘Start’ button for MySql that you clicked in step 3.
Clicking the ‘Admin’ button should open the MySql admin panel in your browser.
From here, click on the ‘Databases’ tab, and then enter a name and click on the ‘Create’ button. As you can install multiple installations of WordPress on your computer, make sure you give the database a descriptive name so you know which installation it corresponds to.
Once you see the confirmation message that your database has been created, you can proceed to the next step.
Step 5: Download WordPress
Once the WordPress zip file has finished downloading, move that file to where you installed XAMPP, and place it in the ‘htdocs’ folder.
Once the WordPress zip file is in the ‘htdocs’ folder extract it by right-clicking on it and selecting extract here or the equivalent.
Again, as you can setup multiple WordPress sites on your computer, you can give the WordPress folder a unique name to help you differentiate it from any others that you might create in the future.
Step 6: Configure WordPress
We are almost done. Now it’s just a case of editing a file and renaming it. In the WordPress directory you just created, find the wp-config-sample.php file and open it with a text editor such as Notepad++.
Once the file is open, find this part and edit the highlighted area to match the name of the database you created in step 4:
Then save the file, and rename it to wp-config.php by removing –sample from the filename.
Step 7: Install WordPress
To install WordPress, go to your web browser, and enter the address: http://localhost/wordpress/ where ‘wordpress’ is the name of the folder you created in step 5. After the page has loaded, the WordPress installation screen will be displayed.
Then fill out the details and click ‘Install WordPress’ and you will have a local offline installation of WordPress running on your computer.
To access WordPress locally, simply go to this URL in your browser: http://localhost/wordpress/ where ‘wordpress’ is the name of the folder you created in step 5.
Tips for Using WordPress Locally
If you want to install any themes of plugins, you can either do it via the WordPress admin area as you would do with a regular version of WordPress, or you can simply copy the files into the corresponding folders on your computer:
- Themes: c:\xampp\htdocs\wordpress\wp-content\themes
- Plugins: c:\xampp\htdocs\wordpress\wp-content\plugins
If you can’t access WordPress locally when entering the address, make sure that XAMPP is running and both Apache and MySql have been started.
If you want to download an online site, for use offline, or vice versa, then the free WordPress Duplicator plugin can help you achieve this.
Hopefully you’ve not got an offline version of WordPress installed on your computer to experiment with. If you have any problems with any of the above steps, please leave a comment below. Also, if you are now the proud owner of a local installation of WordPress, please leave a comment too.