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.

Help me to save time by reading these instructions!

If you are asking a question please read the FAQ to see if it has already been answered. All support questions should be directed to the support forum.

Share:
  • Digg
  • del.icio.us
  • Facebook
  • Reddit
  • StumbleUpon

Comments

Comments are shown on the first page.

Home | Main content | Software | Terms & Conditions | Sitemap | John Godley © 2009