Install WordPress Locally on Windows with Xampp

Today I’ve got a reader-requested tutorial about how you can install WordPress on your Windows 7 computer (same applies for Windows XP & Vista). This is such an important part of my WordPress working life, and if you don’t know how to do it, now’s your chance to learn. But first…..

Why Would I Want to Install WordPress on my Computer?

different local WordPress installation foldersInstalling WordPress locally gives you a fantastic test environment. You can install as many WordPresses as you want on your computer. On mine I’ve got:

  • Single-site
  • Multisite
  • Beta
  • Plugins
  • WordPress

This gives me all sorts of scope for testing stuff out, playing around – a WordPress playground right on my computer.

Let’s get started:

1. Download Xampp

Xampp is an Apache distribution containing MySQL, PHP and Perl. This makes it awesome for WordPress. You can download it from here. 

There are a number of different distributions so make sure you select the distribution that’s correct for your operating system. For the purposes of this tutorial we want the Windows distribution.

Click on the distribution.

Click on the windows distributionClick on the installer.

click on the installer and select save

2. Install Xampp

Double click on the installer and choose your language.

choose your installation language

Decide where you want to install xampp.

choose the location for your installation

Click install.

click install

Sit back, relax, wait for it to install.

it might take a few minutes!

3. Fire up Xampp

Start Xampp. Start Apache and MySQL.

Click on the "Start" buttons beside Apache and MySQL

You may get a warning from Windows. You want to make sure that Windows allows access.

prevent windows firewall from blocking access

You can check to see if your new local server is installed by visiting http://localhost

xampp splash screen

Nice!

4. Set up MySQL Database

On your Xampp control panel click the admin button beside MySQL.

click the MySQL admin button on xampp

In your browser you’ll be taken to the MySQL dashboard. You need to fill in the details for your new database:

Insert the name of your database and choose utf_unicode_8 for collation

  • Set your MySQL connection collation: to utf8_unicode_ci
  • Choose the name for your database. I’m naming this one singlesite – you can call it whatever you want.

Note: if you are doing a live installation on a server you must add a username and password. Do not use “root” ever on a live site. This isn’t necessary on a local installation.

5. Download and unzip WordPress

Download WordPress.

You need to unzip it to the correct folder on your computer. Find the Xampp folder and navigate to xampp>htdocs

location at c > xampp > htdocs

Unzip WordPress there and rename the WordPress folder to whatever name you want. I usually match mine to my database name.

6. Configure WordPress

Open up wp-config-sample.php and find the MySQL settings.

find wp-config-sample in the wordpress folderHere is what you need to update the settings to:

/** The name of the database for WordPress */
 define('DB_NAME', 'singlesite');
/** MySQL database username */
 define('DB_USER', 'root');
/** MySQL database password */
 define('DB_PASSWORD', '');
/** MySQL hostname */
 define('DB_HOST', 'localhost');

Remember to replace singlesite with whatever you called your database.

Save the file in your root WordPress folder as wp-config.php

save your file as wp-config.php

7. Install WordPress

Open up your browser and navigate to http://localhost/singlesite/

The familiar WordPress installation screen will appear.

wordpress five minute install screen

Fill in your details and click “Install WordPress.”

There you go – WordPress is installed locally on your computer.

WordPress installed to localhost

Have fun!

Featured Plugin - WordPress Facebook Plugin

Would you like to add Facebook comments, registration, 'Like' buttons and autoposting to your WP site? Well, The Ultimate Facebook plugin has got that all covered!
Find out more

Featured Plugin - WordPress Appointments Plugin

Take, set and manage appointments and client bookings without having to leave WordPress. Appointments+ makes it easy.
Find out more

Featured Plugin - WordPress Wiki Plugin

To get a wiki up and running you used to need to install Mediawiki and toil away for days configuring it... not any more! This plugin gives you *all* the functionality you want from a wiki, in WordPress!!!
Find out more

Featured Plugin - WordPress Ecommerce Shopping Cart Plugin

Out of all the WordPress ecommerce plugins available, MarketPress has got to be the winner - easy to configure, powerful functionality, multiple gateways and more. A simply brilliant plugin!
Find out more

Featured Plugin - WordPress Q&A Site Plugin

It's now incredibly easy to start your own Q&A site using nothing more than WordPress - The Q&A plugin simply and brilliantly transforms any site, or page, into a perfect support or Q&A environment.
Find out more

Featured Plugin - WordPress Pop-Up Chat Plugin

No javascript required, no third part chat engine, just fully featured chat right in your own database on your own WP sites - couldn't be easier.
Find out more

Featured Plugin - WordPress Newsletter Plugin

Now there's no need to pay for a third party service to sign up, manage and send beautiful email newsletters to your subscriber base - this plugin has got the lot.
Find out more

Featured Plugin - WordPress Membership Site Plugin

If you're thinking about starting a paid, or just private, membership site then this is truly the plugin you've been looking for. Easy to use, massively configurable and ready to go out of the box!
Find out more

Featured Plugin - WordPress Infinite SEO Plugin

Fully integrated with the SEOMoz API, complete with automatic links, sitemaps and SEO optimization of your WordPress setup - this is the only plugin you need to help you rank your site number 1 on Google - nothing else compares.
Find out more

Comments (62)

  1. Why not just use WP as mentioned previously on this blog?

    Are there any advantages to the xampp route instantWP?

    Cause it sure is slick to have it cooking with one click and be able to move the whole WP install around or copy it by just moving or copying one folder.

  2. If you’re doing a comparison you could take a look at Bitnami. I have used this and seems similar to Xampp. InstantWP seems easiest though.

    One aspect worth testing is how each it is to import from your live WP system, dev / test locally and move back.

  3. I’ve used both – XAMPP and Instant WP and IWP is the one I like more. I don’t know for you guys, but on my PC xampp doesn’t work when I am signed in Skype. Need to close Skype in order to use xampp…

  4. Hi Siobhan, your tutorial looks quite straight forward and well presented but i am having problems with step 4. When i click ‘Admin’ next to the mySQL button nothing happens? Ive tried it on windows 7 and XP systems. Ive also asked someone else to test it out on their computer and they are getting the same result. Do you have any idea what the problem could be? Im using Xampp control panel version 2.5 (9. May 2007)

    Also i noticed in your tutorial the Xampp control panel is different in step 4 from the one in step 3. Is there a reason for this?

    Thanks – Dave

  5. As someone who is on the go at nearly all hours of the day, is there a way to manage my wordpress using a mobile version of this? I’ve asked around even called a technical staffing firm, and from what I hear theres only a viewing app from WP but thats it..

  6. Thank you for this article – most helpful. If I want to set up and test multiple WordPress sites, do I follow these steps as written? What would I do next, or instead, to create and connect to the multiple sites? Two are sites that are created that I would like to have also in a local testing environment as we are making updates (it is a free wordpress site), and two are new sites that will be developed and then loaded via hosting (not free versions but hosted WP).

    Thank you!

    ~ Caprice

  7. Siobhan – awesone post and easy to follow. I am having the same issue as Dave 28.aug.2011.
    I have changed the skype port (thanks Stephan) and tried to run Aampp again with no luck. It just keeps running.

    a

  8. Thanks for the tutorial! I am, however, having one trouble spot:

    After several attempts and double checking that I am following the steps correctly, I cannot get past step 6. After saving the wp-config.php file with the proper edits, I try to launch the page at http://localhost/singlesite and get an Error 404 – Not Found.

    I’m not really sure what I’m doing wrong here…any help?

    (I did purposefully name mine “singlesite” as well, for reference.)

  9. Thanks for this wonderful document, for me everything worked fine except last step. But I think, being new to web technology, I’m not keeping my unziped wordpress folder in proper directory. Will you explain where I need to keep my wordpress folder?

    Thanks in advance.

    • Unzip all of the files and folders in the wordpress folder into htdocs/singlesite (i.e. they shouldn’t be in the WordPress folder anymore)

      Or you can unzip the WordPress folder to /htdocs/ in which case your address for your WP site would be localhost/wordpress/

      • I was having the same error message. The way I fixed my problem was by moving the contents of the wordpress folder into one called singlesite (same as above), after that it didn’t recognize the database I had previously created. I dropped the database, and then created another one (named the same thing)and voila!! worked like a charm.

  10. Nicely done, except that your instructions are unclear at a couple of points.

    Under #4, you leave out a couple of steps/screens that appear at least on my Win7, XAMPP/PHPadmin installation: I need to select MySql. Several databases appear already to have been created, included on called “test.” When I get to “create database,” there is no connection option. I get a log-in screen with the user field blank. I used “root,” but it’s not clear to me whether I could have named any user.

    Under #5, you instruct us to “navigate to htdocs,” and advise us to download/unzip WordPress… but you don’t specify where. In the htdocs directory, in a new directory under the desired name of the installation… if you do that, WordPress will download into yet another subdirectory…

    The correct choices for the above will no doubt appear obvious to an experienced user, but will create uncertainty and confusion for a first-timer. The choices would easily and simply be clarified with just a couple of small additions, for instance by showing full paths in the example images.

  11. Hey great Tutorial. I noticed you had a multisite directory in your htdocs, I’m going to guess for this site you enabled the wordpress multisite feature. I’ve actually been trying to do this for some time and I’ve been running into a few problems. It would be great if you could point me in the right direction as to how I would go about doing this properly. I’m OK on enabling the multisite options, most of my problems lie in the configuration of the server and the hosts file.

  12. Also had the same issue in Step 7, with http://localhost/singlesite error!
    Went back to step 6 and inserted my MySql Database password in the MySql Settings section in wp-config.php

    eg…

    /** MySQL database password */
    define(‘DB_PASSWORD’, ‘mypassword’);

    Then accessed WP Setup via url:
    http://localhost/wordpress/wp-admin/install.php

    So far, so good, although I am currently downloading Instant WordPress too as I like the idea of being able to run WordPress off a Flash Drive (which means I can take demo-sites to clients)

  13. A very useful article, for WordPress beginners, for creating test environments. Thanks a lot for such useful article & for sharing this article.. Thanks!

  14. Siobhan,
    Thanks so much for this. I was frustrated because I couldn’t figure out WHERE to put the wordpress folder. You told me! Quick and easy after much troubles elsewhere.
    -dan

  15. I installed xampp and dropped wordpress files into the htdocs directory. When clicking on index.php the browser tries to download the file father than run the php code.

    Any ideas as to what I have done wrong?

  16. I followed all your steps but when i run localhost/wordpress, I am getting

    Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

    Fatal error: Unknown: Failed opening required ‘C:/xampp/htdocs/wordpress/index.php’ (include_path=’.;\xampp\php\PEAR’) in Unknown on line 0

    How shuld i solve thsi? please help me

Participate