How to install WordPress locally for testing, learning, and development

How to install WordPress local testing environments In this tutorial, we’re going to setup WordPress on your local computer (laptop or desktop) to help you develop better themes, plugins, and test WordPress outside a live web environment. What you’ll need to install WordPress on your local computer In order to accomplish this tutorial, you’ll need to download a couple of…

WordPress website development for free

How to install WordPress locally for testing, learning, and development

How to install WordPress local testing environments

In this tutorial, we’re going to setup WordPress on your local computer (laptop or desktop) to help you develop better themes, plugins, and test WordPress outside a live web environment.

What you’ll need to install WordPress on your local computer

In order to accomplish this tutorial, you’ll need to download a couple of pieces of free software from their source websites:

  1. WordPress – wordpress.org
  2. XAMPP – apachefriends.org

The first piece of software of course is WordPress, which is the software we’re trying to get running on your local computer. The second, XAMPP is a self contained LAMP (Linux, Apache, MySQL, PHP) server with all the setup already completed and optimized.

Setting up XAMPP on your local computer

XAMPP Setup 300x262 How to install WordPress locally for testing, learning, and developmentThe installer for XAMPP is a simple process, just follow the steps as you would with any regular installer and wait for the installation process to complete.

Once done, your computer will have a fully functional web server installed and running. From this point, you’ll be able to run any LAMP  web application on your local laptop.

Why XAMPP? Before I continue, there are alternatives to XAMPP including a Macintosh specific and Windows specific version of the software. I’m not sure if the others are any better or worse, but I prefer XAMPP and since it comes in Mac, Windows, and Linux versions it’s the one I’ll recommend.

Configuring your WordPress database

XAMPP Settings 300x224 How to install WordPress locally for testing, learning, and developmentThe next step is to setup a database for WordPress in XAMPP. To do this, you’ll need to open the XAMPP application and turn on the web servers. After turning on your web servers, you should be able to visit your local website environment at http://localhost/ and see the welcome page for the XAMMP server.

To use WordPress on your XAMMP server you’ll need to setup a database by following these simple steps:

  1. open http://localhost/ in a web browser;
  2. open the phpMyAdmin link to open your database manager;
  3. selected Databases from the navigation tabs;
  4. create a new database with an appropriate name (wordpress for example);

Create a database in phpMyAdmin 300x75 How to install WordPress locally for testing, learning, and development

Now that you have a database for WordPress to populate, it’s time to install the software properly.

Installing WordPress on your local server

WordPress in the XAMPP htdocs folder 300x128 How to install WordPress locally for testing, learning, and developmentInstalling WordPress on your local server is now as simple as it would be on any website server except it’s local.

  1. download WordPress from the official source;
  2. decompress the archive;
  3. move the resulting folder to your local htdocs folder;
  4. set the folder permissions so everybody can read / write;
  5. open your new WordPress website at http://localhost/wordpress/ and enjoy;

Since I’ve done this a number of times over the years, there are a few things that I like to keep in mind to help me make the process smoother.

Set your file permissions

Take the time to set your file permissions on the WordPress folder. It may not seem a big deal but without the ability to write files, WordPress will struggle to create the required wp-config.php, .htaccess files, directories, and plugin files you’ll need later.

Local database settings

WordPress wp config file for XAMPP 300x113 How to install WordPress locally for testing, learning, and developmentWhen you’re setting up WordPress, you’ll need to remember your basic credentials:

  • Database Name – wordpress
  • Database User – root
  • Database Password -
  • Database Host – localhost

Remember, there is no password by default for connecting to your local database.

Summary

If you’re still looking for help setting up your own local hosting environment for WordPress, here are some great resources that I can recommend:

Of course, installing WordPress locally created it’s own set of problems from how to migrate your database between a test environment and the live site, to how to debug WordPress, develop themes, and connect to your server. I’ll do my best to find you some new tutorials to help you solve some of those problems shortly.

Christopher Ross

  5 comments for “How to install WordPress locally for testing, learning, and development

  1. Shawn M. Hooper
    May 13, 2014 at 7:49 pm

    Great post, and this is exactly how I’ve been doing my local WordPress development for the last few years. However, recently, many developers have been touting the advantages of using Vagrant (http://www.vagrantup.com/) and I’ve joined that crowd.

    Vagrant sets up a virtual machine on your computer, allowing you to have a development environment that mirrors the software (and the same versions of said software) that you’re using in production – which is invaluable.

    There is a project dedicated to creating WordPress development environments – Varying Vagrant Vagrants (VVV) that I would recommend checking out: https://github.com/Varying-Vagrant-Vagrants/VVV

  2. May 14, 2014 at 11:15 am

    Thanks Shawn, Vagrant is a great way to run WordPress locally as well. It’s a little more complicated but allows for far more flexibility with localized testing.

  3. May 15, 2014 at 1:59 am

    Nice article. Try http://wpstarter.io too. The power and flexibility of Vagrant but easy installation with a wizard.

    • May 15, 2014 at 12:29 pm

      Thanks for that link, I haven’t had a chance to use it myself but anything to make the testing process easier is always welcome!

  4. July 20, 2014 at 12:06 am

    Hi Chris,

    This is certainly going to help me for testing the wordpress websites after customizing and making coding changes. Till date, i used to create a subdomain with demo.sitename.com and test the website, will use this approach and let you know about the experience of using it. :)

Leave a comment, share your thoughts, or add to the value of this article.

Subscribe for free weekly web marketing tips, direct to your mailbox.