Installing WordPress on your own Windows computer

Installing WordPress

Finally we come to the fun part. If you are installing a fresh copy of WordPress then full details can be found in the Codex. You have already created the database so the rest is pure WordPress installation in the document root of a virtual host. A very brief summary of the steps involved are:

  1. Download WordPress
  2. Unzip into your chosen directory
  3. Run the install.php file through your browser
  4. Enter the database details

No further information is necessary.

Duplicating an existing WordPress site is a little more complicated and will be carefully examined below.

Downloading your website

The first step is to download your existing website. This is best achieved using FTP, and a good free FTP tool is Filezilla. You will need to download your entire WordPress installation, as well as any other files you’ve installed such as plugins and pictures. This may take some time, so while it’s downloading we can begin on the database.

Downloading your database

This step can vary depending on your web host. Some hosting companies provide a method of downloading a database directly from the administration control panel. This will certainly be the easiest route, and if available you should download your WordPress database from here (preferably as gzip file to increase speed).

Almost all hosting companies provide phpMyAdmin access to your databases, and so the process in exporting your WordPress information will be given using this software.

You will need to start phpMyAdmin for your chosen database. This may involve entering a username and password, which should be the same as configured in WordPress.

When you loaded phpMyAdmin you need to select your database in the left menu:

phpMyAdmin

It’s important you click on the database name so that the tables for it are loaded on the right side of the screen. From here you can then select the Export option in the top menu:

Exporting

You will then be presented with a lot of export options. The most important is to correctly select the WordPress tables. By default WordPress uses the prefix ‘wp_‘. If you have other software installed you may find other tables here. You should select all the WordPress tables manually, or choose the Select All button.

If you are updating an existing duplicate site then you can skip the wp_options table to avoid overwriting local settings.

Other options you should select are as follows. These may vary depending on your version of phpMyAdmin.

  • Export as SQL
  • Structure โ€“ Add DROP TABLE. Add IF NOT EXISTS. Add AUTO_INCREMEMNT. Enclose table names with backquotes
  • Data โ€“ complete inserts and extended inserts
  • Save as gzipped file

It should look something like this:

Export

When you press ‘Go’ you will prompted to choose a download destination and the download will begin.

Uploading your database locally

After you have downloaded the live database you can upload it to the local website. Return to the local phpMyAdmin screen and select the WordPress database in the left panel. This time select the SQL function in the menu bar:

SQL

You will be presented with a screen where you can execute SQL commands or load them from a file. We want to do the later, so select the file you’ve just downloaded and press go:

Select SQL

The file will then be loaded and all the tables and information will be inserted into your own local database. After sometime you will be informed if this was successful. If all is well then you now have a duplicate copy of your live site!

Connecting your database

You now have an exact copy of both your live database and your live website. This won’t work on your local computer yet as the configuration settings are still for the live website.

There are three steps to re-configuring WordPress:

  1. Change the WordPress configuration to point at the new database
  2. Update the database options so we can access the administration section
  3. Change the blog address so we get full access to our local blog

First we update the WordPress configuration. The database settings are stored in wp-config.php, wherever your WordPress is stored. You will need to change DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST to reflect your new local database. DB_HOST will be localhost.

define('DB_NAME',     'wordpress');
define('DB_USER',     'wordpress');
define('DB_PASSWORD', 'wordpress');
define('DB_HOST',     'localhost');

One small improvement here is to make a dual-configuration file that handles both the local and live WordPress. This way we don’t need to worry about overwriting the configuration in the future.

if ($_SERVER['HTTP_HOST'] == 'local.urbangiraffe.com')
{
  define('DB_NAME',     'urbangiraffe');
  define('DB_USER',     'urbangiraffe');
  define('DB_PASSWORD', 'urbangiraffe');
  define('DB_HOST',     'localhost');
}
else
{
  define('DB_NAME',     'urbangiraffe');
  define('DB_USER',     'urbangiraffe');
  define('DB_PASSWORD', 'urbangiraffe');
  define('DB_HOST',     'localhost');
}

The software now automatically detects if it is the local or live site, and uses the appropriate details.

Reconfiguring WordPress

Go back to phpMyAdmin and select the WordPress database. One of the tables contained there should be wp_options. Select this and then choose ‘Browse’ at the top menu:

Browse SQL

This will then show you a list of all the WordPress database options. We are interested in changing the first option, which contains the URL of the website. Currently this will be set to the live website. We can change this by clicking the edit icon of the siteurl option:

Edit SQL

This will bring up an edit screen where we can change the URL to our local URL:

Edit SQL

Do the same for the ‘home‘ option too.

Now we can log into the administration section of our local WordPress installation. You should do this, using the same user account you use for the live website. When you are logged in you need to make one final change before everything is fully operational. Go to the General section of the Options panel and ensure that the blog and WordPress address match your local website:

Admin

Once that has been saved you should have a fully working copy of your live website!

Support

Please direct all support questions to the Installing WordPress support forum. Any support questions left on this page may not be answered.

332 thoughts on “Installing WordPress on your own Windows computer”

  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 Reply