Installing WordPress on your own Windows computer

We generally become WordPress users to create a blog for everyone to see. This can involve the purchasing of a domain name and web hosting. These we treat as black boxes on which the WordPress software is installed, and everything magically works. This is exactly how it should be.

Although WordPress provides a comprehensive management interface, there are times when it would be better to have our own local copy, running on our own machine. There are several reasons we would want to do this:

  • A working backup of our online site
  • A development site to develop plugins and themes without affecting our online site
  • A testing area to try out hacks and new versions of WordPress without fear of corrupting the live site
  • A staging area to create and verify posts, before releasing them live

Just like in a commercial environment, it helps separate our blog into two parts: production and development, or live and test. Our production blog is the one that is visible to everyone. It might not contain the latest information or the most up-to-date software, but it is fully working and error free. Contrast this to a development blog where we have the very latest software and information, but possibly not fully working.

Separating our site gives us the freedom to experiment without fear of destroying the working version. At the very worse, if the development blog is corrupted we simply re-install the software, and the only loss is our own time. If we corrupt the production site then no one can access our information and we lose visitors.

In writing a set of articles dissecting a WordPress theme, I realised that a lot of people are directly editing their live site. There are many reasons for this, but a good one is probably due to the difficulty in setting up a local system. This is a short guide to try and explain how to do just that.

Installing the server software

WordPress requires several pieces of software:

  • A webserver
  • PHP configured to work through the webserver
  • A MySQL database

None of these are particularly simple pieces of software, and all require configuration to work together. Fortunately there is a lovely software suite called WAMP that packages these together and adds a nice front-end. This is definitely the fastest and easiest way to get it working.

Consequently, the first task here is to download the latest WAMP. Note that this only works on Windows 2000/XP, so I’m afraid you are out of luck if you have anything earlier.

Installing WAMP

Once the software is downloaded we can begin to install it:

WAMP

The installation process is very straightforward. First we choose a destination directory. The default is ideal.

Choose directory

Next we choose whether to automatically start WAMP. You can tick this if you want, but Apache and MySQL make heavy use of system resources and we don’t always need them running. It is much better to start the software on demand, and so leave this option unchecked.

Auto-start

The software will now install.

Installing

After all the files are extracted we are asked for the DocumentRoot directory. This is the root directory for your website and will contain WordPress and any other files you want accessible through the webserver. Unless you have a specific reason, go with the default.

Document root

Next we are asked for the default browser. Your choice here is not really important, so pick whichever browser you prefer.

Browser preference

And that’s it! We now have a fully working webserver on our computer. This same software is used in hundreds of thousands of websites across the world. We also have MySQL to provide our database, and PHP to run WordPress.

332 comments

  1. Hi John
    I followed your tutorial (very good and easy to understand) but at the point where i was asked to edit the:

    “$cfg[‘Servers’][$i][‘user’] = ‘root’; // MySQL user
    $cfg[‘Servers’][$i][‘password’] = ”; // MySQL password”

    in the config.inc.php file I hit a brick wall as the above text is not in the config file so I cannot add the password.
    I have tried uninstalling and re installing but I still get the same error (Http 403 forbidden) message when
    I try to log into the phpMyAdmin
    Any suggestions?

  2. Finally a good explanation about wordpress installation, I’ve found this tutorial already but this one is the most detailed…
    It will be great to explain how to switch this install as a server, and not only as a local site. It will be great if you could explain it…(Stuck to the RSS comment)

  3. When I tried to install wordpress by entering:”http://localhost/wordpress/wp-admin/install.php” into the url of the browser, I got the following respond:”Fatal error: Call to undefined function did_action() in C:\xampplite\htdocs\wordpress\wp-includes\functions.php on line 1345
    “What went wrong?

  4. Hello!
    Very Interesting post! Thank you for such interesting resource!
    PS: Sorry for my bad english, I’v just started to learn this language 😉
    See you!
    Your, Raiul Baztepo

  5. I had to reformat my hard drive and, as a result, needed to reinstall WampServer and WordPress. Originally, I followed the tutorial and had three separate WordPress blogs running on my local machine.

    This time, I’ve installed WampServer 2.0. I’ve edited my hosts, httpd.conf file and created the phpinfo.php file (all with Notepad++). My host file includes:

    127.0.0.1 localhost
    127.0.0.1 local.dcblog.com

    and, to the end of my httpd.conf file, I added:

    NameVirtualHost 127.0.0.1

    DocumentRoot “C:/wamp/www”
    ServerName localhost

    DocumentRoot “G:/Root/www/dcblog.com”
    ServerName local.dcblog.com
    ErrorLog logs/dcblog_error.log

    When I try the “localhost” url, I get the WampServer homepage.

    However, when I try “local.dcblog.com” I get a 403 Forbidden. You don’t have permission to access /phpinfo.php on this server.

    The directory “G:/Root/www/dcblog” exists on my G drive. I’ve tried different variations including dropping the idea of using a different drive; going back and using the tutorial’s original Document root. Same problem.

    Any suggestions on how to correct this error? This is the same config I had before, but this time I just can’t seem to tweak the system to behave.

    1. As a followup to my previous question: I finally chucked wampserver 2.0 and used Revouninstaller to completely uninstall. I made sure everything was gone, including any subdirectories. I then reinstalled WAMP5 v. 1.7.4. Same problems and error messages as with wampserver. I’ve googled the problem and found it is not unusual and is probably related to how I have the directories configured within http.conf. However, no matter how I twiddle with it, I can’t find a solution. I want my wordpress files to reside on a drive other than ‘C’. I had it working once; now, I’m stumped. Thanks!

      1. o.k. I “solved” my problem by digging DEEP and finally found a backup of my original http.conf file. Replaced my new http.conf with the old one and: success. I’m still curious as to WHY the new install wouldn’t work. I’m convinced its operator error, but have not been able to dig it out.

  6. John — Thanks for a great tutorial. One question:

    Do I need to write .htaccess and mod_rewrite rules to redirect the external links to blog posts (that came in with my import of my online blog database) to the new locations within the imported version of my database?

    Sean

    1. Hi John — here’s a bit more info:

      – my blog index.php comes up fine at local.profitscapes.com . I see all the pics, text, etc as the online version.

      – every link to a blog post, category, etc., however, points to its online location (for example, http://profitscapes.com/2009/04/new-ways-for-attorneys-to-grow-billable-hours/ ) — NOT my local version. I checked my local database, and the data is there, but the wp_posts field holds links to the online locations.

      Thoughts?

      Thanks,
      Sean

      1. Hi John,

        I’ve figured out a few things — I tweaked my database siteurl and home settings so that now my blog posts, pics, etc. point to a local source, but when I click on any blog post, I get a 404 error.

        A sample broken link:

        http://local.profitscapes.com/2009/04/new-ways-for-attorneys-to-grow-billable-hours/

        My virtual host info is:

        # NameVirtualHost 127.0.0.1

        #
        # DocumentRoot “C:/xampp/htdocs”
        # ServerName localhost
        #

        #
        # DocumentRoot “C:/xampp/htdocs/BurnsGroup_Site/blog”
        # ServerName local.profitscapes.com
        #

        #
        # DocumentRoot “C:/xampp/htdocs/BurnsGroup_Site/consult”
        # ServerName local.consult.profitscapes.com
        #

        Any tips would be greatly appreciated,
        Sean

  7. Hi John,

    Thanks for the tutorial!

    I’m a bit stuck with the wordpress installation. I can get as far as the page that asks for Blog title and email. From another tutorial, I gather that i am supposed to see a “Successful installation” message with my login and password. However, my page stays stuck after i key in blog title and email.

    Any idea how to resolve this or what did I miss? Thanks in advance!

  8. This was an awesome tutorial. One of the most unambiguous I’ve come across. Everything worked first time.

    Thanks

  9. Hi John, Thanks for the great tutorial which I’ve used successfully on Windows XP. The instructions are very clearly explained and the accompanying images are so useful.

    However, I’ve just purchased a new Windows Vista computer and I’m stuck on page 3 of your tutorial – I can’t locate the “host” file in the Windows 32 system, drivers, etc folder – there isn’t such a folder. Plus there’s also a Windows 64 bit system folder.

    Any advice on how to finish installing WAMP on the Vista system would be greatly appreciated as I have several sites in development that I’d like to use the new computer for.

    Cheers, and thanks in advance for any help you can give ……..

    1. Oops – turns out all I needed to do was turn on the hidden files to find the etc folder and the host file. Thanks to the folks at sitepoint.com forum who pointed that out to me!

  10. Thank you, thank you, thank you! This is just what I was looking for. I’m a newbie to web design and PHP etc., but have been tasked with redoing my small library’s website. After deciding to use WordPress as the CMS, our tech guy wouldn’t allow me to install it on our local server until I “knew what to do.” Now I’ll do the install on my local computer until I get the hang of it. I’ll show him!! 🙂 Thanks again.

  11. I have a problem with phpMyAdmin. When I load it from the link on the WAMP homepage, it gives me the error “Cannot load mysqli extension. Please check your PHP configuration. – Documentation.” I checked the documentation and it says that the mysqli extension not being found means that php_mysql.dll can’t be found. I checked the php bin that came with WAMP and in /php/ext/ the file php_mysql.dll is there. I changed php.ini to have the following:

    ...
    ;extension_dir = "./"
    extension_dir = "./ext"
    ...
    ;extension=php_mysql.dll
    extension=php_mysql.dll
    ...

    Thats what another site said to do, and that didn’t work. I added the file libmySQL.dll to my system32 folder which another site said to do, and that didn’t work. Can anyone tell me how I can get mySQL to find php_mysql.dll?

  12. Hi John
    I followed your tutorial (very good and easy to understand) but at the point where i was asked to edit the:

    “$cfg[‘Servers’][$i][‘user’] = ‘root’; // MySQL user
    $cfg[‘Servers’][$i][‘password’] = ”; // MySQL password”

    in the config.inc.php file I hit a brick wall.
    the path to config.inc.php i have in the new wamp software is x:\wamp\apps\phpmyadmin3.2.0.1\config.inc.php
    When i change the password in that file all i get is;
    Error
    MySQL said: Documentation
    #1045 – Access denied for user ‘root’@’localhost’ (using password: NO)
    when i try to connect to phpmyadmin

    i just cant get this to work please help?

  13. not sure why others are having a problem doing this. It was pretty clear how to install WordPress using WAMP from reading your post. I think I’m going to test this out, only this time, i’ll use Apache on Ubuntu 🙂

  14. Thank you so much 🙂

    I already had a local installation of wordpress on wamp but I needed to develop two more sites and was getting the ebejeebies at how that was going to happen without running into loads of problems. After a bit of searching and lots of – no hit but plenty of miss – I came across your instructions and it worked like a dream.

    I now have three installations of wordpress running from the same installation of wampserver 2.1e

    You are the dogs 😉

  15. Hi John,

    Looked at your instructions but not sure if your site is applicable to what I want to do. I want to know if I can download the WordPress installation to create my own website to a location like a flash drive and/or a Windows computer so I can take it with me and be able to work on my site from another computer other than my own laptop, which is a 2004 macbook.

    Thanks,

    John H

Leave a comment

Your email address will not be published. Required fields are marked *