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!

ManageWP
Are You Spending Valuable Time Managing Your WordPress Websites?

Over 70,000 users depend on ManageWP to save them time and trouble by managing all of their sites from one central location.

114 Comments

Join The Discussion

114 Comments

  1. mix624 says:

    Hi,

    Is it possible to make a wordpress site into a standalone executable file that I can give away as a download ?
    I have a site with 100´ds of mp3´s and I want to make it downloadable so anyone can use it offline.

    I have tried some of those site downloaders for offline browsing but the plugins for the audio player doesnt work with that and it doesnt seem to be a good idea ? Any tips ? Wouldldnt work if someone who wants the site have tp gp through a lot of complicated steps though, like with Xampp.

  2. Nick says:

    Tom, you are the coolest!

  3. Van Le says:

    I'm using Laragon (http://laragon.org/).
    Install WordPress is just one click and see.
    Note: Laragon is isolated. You can move the project to everywhere you want.

  4. Victoria says:

    Thanks, your instructions helped me install a localhost version of WordPress for test purposes on the first try.

  5. matia says:

    I succesfully installed my offline local hosted wordpress website with xampp. I bought a wordpress theme, but when I try to upload and install it, wrdpress give me this message:
    "Warning: POST Content-Length of 14577143 bytes exceeds the limit of 8388608 bytes in Unknown on line 0
    Are you sure you want to do this?

    Please try again"
    What can be the problem? do you think it is because of a too big page for a local host on my PC?

    • Igor Kolosov says:

      Which settings did you put in Xampp? For example, how much memory did you give to the local server?

      • Nick says:

        Hi Igor,

        We tested this using virtual ware in college. At the time I personally just assigned about the same for a Windows 7 virtual system (2048Mb).

        Hope this could help?

        Nick

  6. Raphael says:

    Worked perfectly on the first try, thanks!!

  7. George says:

    Tom, will following these very clear instructions (THANK YOU!!) create a problem with a SQL database I use for a different program? My contact manager (ACT!) uses an SQL database and I 'm assuming that the SQL this program accesses won't clash. Do I need to be worried? And thanks again for such very clear directions!!

    • George says:

      I tracked down the answer from both Apache and ACT! and all is okay. And it has worked so far just fine. Now I need to build the site I want and then figure out how to upload it to replace the current non-WordPress site for my url. Happy days! Thank you, Tom!

  8. Peter says:

    Hi there,

    I tried running the instructions: 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:
    Everytime I try running this with I get the following;

    Object not found!

    The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

    If you think this is a server error, please contact the webmaster.

    Error 404

    localhost
    Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.5.15

    any help please????

    • Lee says:

      I had the same problem (I'm running Windows 8.1 and just downloaded version 4 of WP). The way I fixed it was to go back through and be more careful about two steps I had rushed through, although I cannot tell you which measure actually did the trick:

      1. Went back and made sure I really opened (extracted) the zipped WordPress folder and renamed it as "mytestsite" as instructed. The first time around I had opened it but it did not request a new folder name so I left it named as "wordpress."

      2. When opening the wp-config-sample file in Notepad as instructed (it first opened in Dreamweaver by default and editing it there did not work for me), I needed to rename it carefully with the .php at the end of the file name and save it as "all files" and not as a .txt file in the Notepad dropdown menu when saving it. The first time I unintentionally saved it as a .txt file, despite putting a .php suffix, and that did not work.

      3. After all that, in the browser I entered http://localhost/mytestsite/ and it worked, just clicked on the WordPress folder that appeared for installation.

      These two changes allowed it to work for me, hope it helps others.

      • Julianna says:

        Lee, I've been struggling for a few hours and I tried both the things you suggested and it let me move forward to the next step finally. Thank you!

        • Nick says:

          Yeah that was just a unintentional mistake on the author's part I think. He meant to say to name the database the same as your site's name, and the directory holding all your wordpress app's files in htdocs.

          On hosting, the wordpress files would typically all go into your FTP account's domain or subdomain name in the root or in the folder "public_html".

  9. shridip says:

    Thank you TOM

  10. KarSho says:

    Simply thanks Bro…

  11. Jan says:

    Great easy steps to follow! Worked straight from the start!! Now I can see if WordPress is something for me.

  12. 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!

  13. Jay says:

    Bravo! Many thanks for this excellent tutorial!

  14. 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

  15. Tanka says:

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

  16. 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

  17. Payilagam says:

    Excellent buddy! My long term dream comes true today! Your blog helped me a lot to create my own website. thanks a ton.

  18. hello
    using your provided information i able to install WordPress on xampp and it is working good

    thank you so much

  19. Andrea says:

    Hi Tom,
    I'm almost finished setting up my test site, but having some troubles…i got stuck on this part:
    Open up a fresh browser tab and navigate to “http://localhost/yoursitename/”

    I typed in "dickeybub" for my site name and nothing happens….can you help me figure out what my site name should be? I know this sounds like a silly questions, my i'm not very "configuration" savvy. If you can give me as much detail as possible on where i can find my wordpress website's directory, that would be great. Thanks so much

    • Andrea says:

      Tom, nevermind, i figured it out. However, can you tell me how i can transfer my LIVE website to my TEST site?

      • Chris says:

        Hi Andrea,
        There is an easy to use free plugin for wordpress that will allow you to zip your files up export a dump of your data base, and give you an installer file, skipping the whole creating a new version of wordpress on your local host, Just go to your live site install this plugin, search for "duplicator" by LifeInTheGrid (without quotes) and create a backup, download the installer file and the zip file, go to your download directory and copy it to your folder in xampp localhost, create a fresh database in phpadmin, making write down name or if you have already created one, edit via phpadmin, and check all and select drop, to remove all tables, (important needs to be a fresh file). Then double click on the installer.php file and follow the settings, making sure you specify localhost, database name, database user and password, you have an option in this installer, to disable plugins (incase you are running security plugins) and create brand new users. Also if your live site has limited security make sure to go and delete the duplication just made, because with the information in your database dump if someone was to download that, they could easily break into your admin area. Also If your site is using ssl, you can create an ssl to use in xampp, by typing https://localhost/ hope this answers your question.

    • Payilagam says:

      Hi Andrea,
      you should mention your folder name (under htdocs, which is 'wordpress' by default). I hope you missed that.

  20. Pawas Gupta says:

    Hi Tom,

    Thanks to you I finally got it right. Your post was so easy to understand for a non technical guy like me. I really appreciate your contribution to the community.

  21. michael says:

    hey tom, your solution looks brilliant. one challenge– i'm on a chromebook, so i don't have an OS, per se. any ideas?

  22. FENEXPERT says:

    Great job. THANK YOU !

  23. Imran Khan says:

    Great Job done Tom!!!,
    It's been almost 10 days i was struggling with Apache, Mysql and php installation and configuration. Though I installed and configured Apache & Mysql flawlessly but when it was php turn, i failed badly with interfacing…Finally decided to go with your instruction and it worked charmingly within few minutes….Great work…keep it up…Continue the Good work…expect more from you…:)

  24. Chris says:

    A word of thanks to people like Tom who go the extra mile to make things easier for those that follow.

    Let me admit I would have made it even easier for myself if I literally followed Tom's guidelines. I found them (in retrospect) accurate and helpful.

    Chris

  25. Hi Tom. I have found another topic in your blog explaining how to download an existing site. I will have a go using your directions there. I am sure they are just as good as what I have used already and will get there. Once again – thanks a lot. allan

    • Tom Ewer says:

      No worries Allan, let us know how you get on!

      • Hi Tom. Got quite a long way (in spite of interruptions – I am in South Africa and there is a lot going on here right now – very sad though). I got to the bit where I downloaded the SQL database from my site – it did a screendump of a big text file that didn't mean much to me. But the hardrive was running for a long time so something was happening. I don't know where it has saved the databas, or what it looks like. It was called CLDBHOST_mxxxxxxx on the server. I was able to get to it there with my username and password. Any clues would help please. Thanks allan

        • Hi Tom. Got a bit further and almost there. Followed your directions very well. Just get the following errors …"Warning: require_once(C:\xampp\htdocs\Kwamadala/wp-load.php): failed to open stream: No such file or directory in C:\xampp\htdocs\Kwamadala\wp-blog-header.php on line 12

          Fatal error: require_once(): Failed opening required 'C:\xampp\htdocs\Kwamadala/wp-load.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\Kwamadala\wp-blog-header.php on line 12

          Please help. Thanks allan.

          • Hi Tom. I worked out from the error message that there were some files missing so FTP'd everything down again and established they are all there. New problem. Trying to import the exported database using phpMyAdmin but it is too big. 2048 allowed – it is 2236. I looked at FAQ and it suggests a few workarounds. Maybe you got a good one to suggest Thanks again allan

      • andi says:

        Hi Tom,

        On the fourth step you shared four changes that need to be made; I am not clear on exactly what those changes need to be … one it appears has to do with mytestsite, followed by root and then two others which follow.

        My question is what are the exact changes that need to be made?

        I did understand with the mytestsite that you suggested that would be changed to whatever the name of the site is please confirm whether that was what you were saying and then with the following three changes what changes need to be made there exactly?

        Thanks

        Andi

      • Hi Tom. Max size problem sorted – used PhpMyAdmin on the server rather than the one that comes with Xampp. That version allowed 8192. New problem. The import starts, but I now get an error .. "Error SQL query:

        – Dumping data for table `pageflipbook`

        INSERT INTO `pageflipbook` ( `ID` , `adresse` , `lien` , `detachable` , `is_double` , `is_preloaded` , `categorie` , `position` )
        VALUES ( 1, 'XQVOnM7.jpg', 'http://', 0, 0, 0, '', 0 ) , ( 2, 'JebYZOT.jpg', 'http://', 0, 1, 0, '', 1 ) , ( 3, 'JOHMdaL.jpg', 'http://', 0, 1, 0, '', 2 ) , ( 4, 'hrSaiEr.jpg', 'http://', 0, 1, 0, '', 3 ) , ( 5, 'e69prPn.jpg', 'http://', 0, 1, 0, '', 4 ) ,( 6, 'b2VvsMh.jpg', 'http://', 0, 1, 0, '', 5 ) , ( 7, 'bkZaTxN.jpg', 'http://', 0, 1, 0, '', 6 ) , ( 8, 'RWnM3aP.jpg', 'http://', 0, 1, 0, '', 7 ) , ( 9, 'XIBmwEZ.jpg', 'http://', 0, 0, 0, '', 8 ) ;
        MySQL said:
        #1062 – Duplicate entry '1' for key 'PRIMARY'

        Any clues to a solution would help greatly. Thanks allan

      • Hi Tom. Yep – it's me again. I worked around the size problem by zipping the database and using phpMyAdmin in Xampp. I then made the changes to siteurl and home. Still don't work – "Error establishing a database connection". I have all the WordPress stuff in Xampp/htdocs/kwamadala. I really have no idea where the database is sitting. Could it be in the wrong folder? Hope you can help. tx allan

        • Lena says:

          Did you get a response regarding database connection? I am also getting this error. Using Windows 8.

          • Lena says:

            I finally figured out what the connection issue was. Allan if you go to your phpAdmin file, you should see a database called "test." in your wp-config.php place this as the database name and leave the username and password sections empty. Make sure there are no spaces between the single quotes.

            Hope this help.

          • Tom Ewer says:

            Thanks for your helpful input Lena!

      • Hi Tom. You must be getting a bit sick & tired of me. I am there at last. Just kept plodding on (only way a 70 year old can do it!!). It is now working. I kept referring back to your other blog on downloading a site to a local machine. The "Flippingbook" plugin doesn't work at localhost level – permanent error? I must now also work out how to get to wp-admin on the local site, but am sure I will get there. Thanks once again for all the invaluable tips and directions you give on your blog. Much appreciated. allan

  26. Hi Tom. Thanks a lot for very easy to follow directions. I got a long way down but am a bit stuck now. I have a WordPress site and want to copy that down to my local machine. I have downloaded the WordPress folder via FTP but can't get to it and don't know what changes I should make to the wp-config.php file and anything else I need to do. I am also not sure where I can find the database file on my site (unless it came down in the WordPress folder) to get it down into the correct folder on the local machine. Any pointers would be most welcome. Thanks Allan

  27. Hasan zahid says:

    Its really awesome. Detailed as much i wanted . Thanks Tom

  28. anthony.wells says:

    Not sure what to put in root,password,localhost in Section4. Help please new to this stuff!!!

  29. stephenmassam says:

    Awesome tutorial,great content

    Cheers,Tom

  30. Leo says:

    Excellent tutorial. I had it running without problems in about 15 minutes.
    Question: Is it possible to load an existing website? I can create a new one from scratch.

  31. Ratchaphol says:

    Hi Tom! Great post anyway!
    Did you finish the post abt how to transfer this local installed wordpress to live and online?

    Thanks!

  32. Nate says:

    Gosh! I've been using WP since 2009 but never installed a local version as I was always scared for some reason. Setting up the server seemed complicated; but it isn't.

    It took less than 5 minutes… which sounds a silly statement as I've long known about the famous 5 minute install. But that was just knowledge, I've now had a revelation!

    From now on I'll be building local WP's for all of my sites and doing development there rather than on the live site.

    Yes I do feel stupid for not doing this sooner. Thanks for the tutorial.

    Nate

  33. Deanos says:

    Brilliant tutorial! Many thanks!

  34. GAR says:

    This is BS…
    http://screencast.com/t/zWhvLGV9Oev

    Error because skype is using the ports. Closed skype to make it work, but skype is a very common application which many people use.

    Please improve the tutorial teaching how to change the port its using.

    Thanks, this site helped me a lot, good quality :)

  35. Tom says:

    I am trying to build a site with a template. When I try to upload it, I get this:

    Warning: POST Content-Length of 25195004 bytes exceeds the limit of 8388608 bytes in Unknown on line 0
    Are you sure you want to do this?

    Is there a way to bump up the size limit?

    Thanks,

    Tom

  36. stephen says:

    Great article. But how do you upload the finished test site to a real domain? Do I have to install wordpress and Genesis framework on the new domain too? Or will it come along when I upload everything from my computer?

  37. Vikas says:

    I am only 3hrs old with WordPress and had terrible time finding a tutorial how to get this working locally. Your tutorial was great and within 1hr after finding your website link I was able to develop a dummy website using WordPress. Great work, thanks for sharing your knowledge.

  38. Ali Ashiq says:

    can you tell me please how to install xamp in windows 8! i am totally fedup and when i installed xamp it does not working

  39. Cheryl says:

    Tom,

    OMG, You made my day! :D
    Thank you for your clear directions.

    I did have to go into Users once in phpMyAdmin, add a user and assign privileges for my site.

    If I remove root privileges, will that funk things up, or will it 'plug' a security hole?

  40. Javentira says:

    This is what I need :D .
    Installed XAMPP 3 days ago and until now I don't know how to add my site to localhost.
    thank you for sharing this information :D

  41. Cazaura says:

    Hi

    Just wondering whether something like this can also be done on a flash drive – I'm sure I've seen that mentioned somewhere? Rgds.

  42. Razer says:

    Thanks Tom. The tutorial was well written, concise and major helpful. I appreciate the effort.

  43. Steveorevo says:

    Not only is ServerPress easier (it is XAMPP only WordPress centric), but it also reads ManageWP backup archives. What good are backups if you can't load and compare them in a few clicks?

  44. Keith Davis says:

    Fabulous article.
    A question…
    When you create the database don't you have to create a user and give them admin rights etc?

    Long time since I did it but I do recall having to set up a user with all privilages.

  45. Cathy says:

    You left out a few steps. I kept getting prompts that were not in your instructions. Giving up and starting over.

  46. Charles Shields says:

    Didn't work for me. This is 2nd tutorial I tried with Xampp. Neither worked. Have to find a local guy to come over and install for me. $100.

    • Mini says:

      Lookup ServerPress.com's DesktopServer; it even opens up ManageWP archives instantly so that you can compare them, right on your desktop.

  47. brett_bumeter says:

    XAMPP totally drives me nuts, always has. I swear it is also a PC killer.

  48. Mike Smith says:

    Once you've created your local site you can use the duplicator plugin to back it up and upload it on to your hosting account. It's free and available here http://wordpress.org/extend/plugins/duplicator/.

    The instructions are reasonably easy to follow.

  49. Kim Holman says:

    Wow…these directions are the bomb. I've hesitated to create a local copy of wordpress and thanks to you, it was so easy.

  50. Ponfe says:

    I've tried EasyPHP and XAMPP now, but in neither of them can I access to phpmyadmin. I cannot figure out why this problem persists. Any ideas?

  51. David G. says:

    Thank you so much!
    Easy, fast and accurate.

  52. vini says:

    thanks a lot for providing information on creating multiple offline websites. I was kinda stuck on this step for a while.

  53. cliclocal says:

    Great post, after you develop the site locally, whats the process for uploading it live

  54. Great googlymooglies. I'd forgotten how nice it is to have a local web server to dink with.

  55. Confused with two comment forms on this tutorial. WebMatrix 2 is even easier as it downloads and installs WordPress for you and the local WordPress is put in the My Websites folder in the My Documents folder.

    Within WebMatrix you can view the files, db and edit them as well. So I've now looked into an alternative but I'll be sticking with WebMatrix 2.

    Maybe Tom have a look at WebMatrix 2 and compare both with the pro's and cons.

    • Tom Ewer says:

      Yeah, the two comments forms is a funny one – we're consolidating down to one for our upcoming redesign though, so the confusion won't last for much longer ;-)

      I've never heard of WebMatrix, but I will most certainly be taking a look now. Cheers!

    • It's developed by Microsoft and you can install other popular Blogs,CMS, ecommerce and more….with ease well worth taking a look.

  56. egiova says:

    Personnaly I use Bitnami Wamp Stack (bitnami.org), because of its modular structure, it enables the installation of several "modular stacks". For example: I installed WP, Joomla! and Drupal on my machine. It works just fine for me since six years.
    Did you hear from it? Xampp is just too restrictive to me, or I don't know how to manage it.

    Godd tutorial anyway, thanks.

    • Tom Ewer says:

      Hello,

      I'm afraid that I haven't used Bitnami – I've never had a reason to. As far as I am aware, Xampp is in no way restrictive when it comes to creating local installations of WordPress (which is of course the point of this tutorial). I have 3 WordPress local blogs all running on Xampp with no issues.

      Cheers,

      Tom

Speak your mind