Anyone who works at the backend of a website will appreciate the need for a test website where they can freely try out stuff before making changes to a live website. To be able to mess around without fear of breaking your website, you can install WordPress on a local server using XAMPP. This post will guide you to create a local server on your computer and then install WordPress on that server.
What is XAMPP and What is Local Server
For newbies, that’s two new terms that may need explaining – XAMPP and Local Server. In simplest terms, a local server is a server housed in your own computer. Normally, when you type an address on your browser, it accesses files of a website that are housed in an external or remote server. In a local server environment, the files of your website are housed in a server created in your own computer. The browser will communicate with the your computer to retrieve the files.
XAMPP is a free, open-source, pre-configured package that can run from a local drive. It installs language, local server and database server in your computer in a few minutes.
Why You Should Use Local Server
- To preview and test the different changes you make, you need a server to execute the server side code. It’s prudent to always go offline while making important changes at the backend of your website. Even if you’re an expert, mistakes can happen that can take hours to correct. Testing changes on a local server can prevent downtime or security breaches.
- The test site can provide the framework for you to play around with different tools and hone your skills as a developer.
There’s a lot you can do on a local server like testing out plugins or color schemes. However, a local server is not a perfect testing arena and it does have limitations such as:
- You cannot test website speed or analytics while on a test site. You’ll need a live environment to test these aspects.
- It’s also possible that any changes you make may not play out exactly the same way on a live website on account of differences in hardware.
If you’re particular about previewing the effect of the changes on your website, a staging environment will serve you better. Many server hosts offer a staging site where you can test changes. Or you can create a staging site using a plugin like WP Staging or even create a subdomain manually with some coding.
Let’s get on with the setup,
Download and Install XAMPP on Your Computer
The first thing to do is to visit the Apache Friends website and download the Installer files for Windows.
Next, run the Apache setup.
You’ll see prompts relating to User Account Control and Anti Virus software. Check the boxes as required and proceed with the installation.
On the next screen, select the components you need. To install WordPress on a local server, you do not need all the components, so select as shown in the image below.
At this stage, you can select the folder into which the XAMPP installation should go. If you’re unsure, go with the default option.
You can skip the Bitnami installation and proceed with setting up XAMPP by clicking Next.
The progress bar helps you keep track of the installation process.
On completion of installation, launch the Control Panel by checking the option and clicking Finish.
Check To See If Local Server is Created and Functional
On the XAMPP Control Panel, you need to start two modules – Apache and MySQL.
If you’ve executed the steps correctly, the two modules will turn green on the Control Panel.
To check that the local server is installed, simply visit http://localhost on your browser.
Install WordPress on a Local Server
Now that you have a local server installed and functional, the next step is to install WordPress on this server. You can freely download WordPress from WordPress.org.
Find the folder where you installed XAMPP. Within this folder, look for the htdocs subfolder.
Within this htdocs folder, create a new folder and give it any name you want. This will be the name that you’ll use in your browser to access your site. I’ve called my folder Localsite and to access this site on my browser, I’ll have to type http://localhost/localsite.
Into this newly created folder, extract the WordPress files from the WordPress zip file that you downloaded from WordPress.org
Setup Database for WordPress
To setup a database for your WordPress, go back to the XAMPP control panel and start the PHPMyAdmin.
Click Databases ……
…… and then Create Database. Fill in the database name and click Create. Note down this database name carefully as you’ll need use it again to complete installation.
Complete WordPress Installation
Now that you’ve got the server and database operational, let’s complete installing WordPress. Visit your site using a browser and typing your site address. My site address is http://localhost/localsite as I used localsite as the folder name into which I extracted the WordPress files.
Follow the instructions in the installation process until you land on a screen similar to the one below.
Fill in the database name you created using PHPMyAdmin, leave password blank and fill in “root” for username.
In the subsequent screens, you’ll be required to fill in the name of your site, username, password and email id. And click Finish to complete the installation. You can see the confirmation of successful installation.
You can now login to your website and create your first post.
Once you’re familiar with setting up WordPress locally, you can create as many test sites as you want on your computer. They can be really helpful to website developers. Not only can they try different tricks on a test site, they can do it away from the public or clients’ gaze. It can also help to show various possible designs and settings to clients to help clients preview and choose the ones they like.