How to Create a Local WordPress Website in Windows with Xampp

How to Create a Local WordPress Website in Windows with Xampp

I believe that all WordPress users should have a local installation of WordPress on their PC. The benefits are numerous – you can test themes, plugins, and fiddle with a blog’s design without anyone seeing. It’s lightning quick. There is no danger of being indexed by Google. You can even take a whole website, download it to a local WordPress installation, and play around with it to your heart’s content before uploading the changes.

But local installations of WordPress aren’t just for developers. For instance, I have an offline accountability blog that I use to keep track of my life goals. I have another local WordPress installation where I draft articles that I write for clients.

Whilst setting up a local WordPress website may instinctively feel like it would be a complicated process, in reality, it is not. Any competent PC user can have a local WordPress installation up and running within a few short minutes.

1. Download and Install Xampp

In order to install and run WordPress locally, you need to create a local server environment. Fortunately, this is easily done with a free piece of software called Xampp. You can download Xampp from this location – click on the “Installer” option:

Download Xampp

Double click on the installation file once the download has been completed. You will be prompted to enter an installation directory:

Install Xampp

It is recommended that you do not use the Program Files directory, because of potential write permissions issues. Please note that the directory you choose at this stage will be where your local WordPress site’s files are located.

Proceed through the installation process – there is no need to adjust any of the default installation settings.

2. Set Up Xampp

Once the installation process has completed, load Xampp and Start the Apache and MySQL modules:

Xampp

You may be presented with a security alert that looks something like this:

Windows Security Alert

You need to select “Unblock”. Once you have done so, the local server environment should be up and running. To check, open your browser and enter “http://localhost/” into the address bar. You should see something like this:

localhost

3. Create a Database

Every WordPress installation needs its own database, so before we install WordPress proper, we need to create one.

From the same screen where you Started the Apache and MySQL modules, select the MySQL Admin button. This will open up phpMyAdmin in a browser tab. Select the “Databases” tab – here you will create your database:

Create Database

You can use whatever name you want, but I would recommend something descriptive. Click on “Create”, and you’re done!

4. Download, Configure and Install WordPress

Grab yourself a copy of the latest version of WordPress from the WordPress.org home page. Once downloaded, unzip the file. I would recommend that you give the resultant folder the same name as your database.

Find the location where you installed Xampp (if you didn’t change the directory during installation, it will be “C:/xampp”), and open up the “htdocs” directory. Paste your WordPress folder into this directory. This is where your local website’s files will live.

Double click on your WordPress folder and open the “wp-config-sample.php” file with Notepad. There are a few variables you need to change in here:

wp-config

Obviously, your database name may not be “mytestsite” – it will be whatever you named your database in phpMyAdmin.

Once you’re done, save the file and rename it as “wp-config.php” (i.e. remove “-sample” from the filename).

The only thing left to do now is install WordPress using the 5 minute installation process (which in reality will take about 30 seconds).

Open up a fresh browser tab and navigate to “http://localhost/yoursitename/”, where “yoursitename” is the name of your WordPress site’s directory. You will be presented with a familiar screen:

WordPress Installation

Fill in the details, hit the “Install WordPress” button, and you’re done! You are now the proud owner of an offline WordPress site:

Offline WordPress Site

You are now free to edit and add to the site in whatever way you see fit. You have access to all themes and plugins as you would do with a “normal” WordPress installation. You can even add the site to your ManageWP account by using port forwarding. Furthermore, you can create as many of these sites as you wish, just by repeating steps 3 and 4.

Enjoy!

Access, manage, update and backup all your WordPress sites from one powerful dashboard

Sign up - it's free!
post a comment

93 Comments

  1. tony says:

    Once i build a wp site locally how can i install these files on a established site?

    I'm assuming ftp the files to the site hosted online.

    But exaxtly what files should i copy to the host and exactly where?

    I can try and figure this out myself but i would like to get it right the first time.

    Thanks for a great tut!

  2. Jay says:

    Bravo! Many thanks for this excellent tutorial!

  3. Ties says:

    Just followed all the steps in this tutorial and everything went well untill I started the WP instalment. The screen froze halfway but when I refreshed it said WP was already installed.

    I tried to login using the username and pasword I created but it won't log in. Now when I go to http://localhost/mytestsite/wordpress/ it just tells me "nothing found"

    Had the bright idea to unstall WP and reinstal but in the control panel under programs I can't find WP to even uninstall.

    What should I do? Thanks a lot

  4. Tanka says:

    Thanks a lot.
    Please suggest how to add open conference system (http://pkp.sfu.ca/ocs/ocs_download/) to the website.

  5. Donal says:

    I did my install, but I can't find where on the disk the installation went to. Can you tell me how can I find this out. (I've looked in the xampp/htdocs folder for a wordpress folder, but there aint any :-(
    Thanks