Testing New WordPress Versions Part 3: The Files

calendar Posted on September 18, 2007   comments 6 Comments

This is Part 3 of a multi-part series of posts discussing how I test new major releases of WordPress before upgrading my “live” sites. The first step got us rolling with a XAMPP install .  Next, we copied our Live database to the test environment. This step will tackle copying the actual blog files and content (pictures, themes, plugins, etc) and getting it all running locally. Subsequent articles will discuss the actual upgrade and whatever else seems useful…

We have our XAMPP environment. We have our database copied. Now we need some files to make our WordPress installation actually run. When we’re done with this step we should have an almost identical copy of our live blog running on our PC.

Even if you’re not concerned about upgrading, this is great for testing plugins and doing theme development!

Landing Zone

First we need a directory that we’ll copy everything into and our XAMPP Apache web server can access.  The XAMPP folks make this pretty simple — just head over to the Programs menu, go to Apache Friends -> XAMPP  and click on XAMPP httpdoc folder:

Finding XAMPP httpdoc folder

This is the folder that should contain anything that you want to use with your local web server.  (by default, this is C:\xampp\htdocs)

Create a new folder in the htdocs folder (right click, new -> folder).  I’m going to name mine “23_testing” since this is the installation that I plan to do WP version 2.3 testing against. It doesn’t much matter what you name it, just remember the name for later.

My new 23_testing directory

Bring Down Those Files

There are many ways to copy files from a server to a PC. While I tend to use WinSCP for this, I’m going to orient this article around FTP and the FileZilla client. I’m also going to assume readers have some level of experience with FTP clients. The WordPress Codex article, “FTP_Clients” can offer a bit more background if you get confused — as can a web search for FTP tutorials.

So, to get started you need an FTP client, the FTP address for your site, and your username and password.  Only you and your host can help you with those — please don’t ask me what they are.  :-)

Fire up your FTP Client and connect to your server.  In the picture below, I’ve entered the necessary data into FileZilla and hit enter:

image

Most clients will show your local files in one pane (left) and the server files in the other pane (right).  On the local side, we need to get that over to the new directory we just created in the previous step.

For the server pane, navigate into your blog directory.  You’re in the right place when you can see the wp_content folder:

Selecting the remote directory

image Note: Click the thumbnail to see a larger view of the local and remote panes.

Now we’re going to copy everything from the remote to the local. Click on any file in the remote pane and hit Ctrl-A — that should select all the listed files and directories.

Next, click and drag from the remote pane to the local pane and then kick back and wait. Depending on your Internet speed and amount of content, this might take a while! Every theme, plugin, uploaded picture is on the way to your computer.

Local Adjustments

Home stretch now. We just need to make a few adjustments to the local copy of  wp-config.php. This is the file that tells WordPress about your database connection and some other key options.

Where is it? In my case it’s under htdocs/23_testing (remember, you can quickly get back to htdocs via that link in the XAMPP program folder).

Open wp-config.php with your favorite text editor and chang the following:

define('DB_NAME', 'wp_test');     // The name of the database
define(’DB_USER’, ‘root’);     // Your MySQL username
define(’DB_PASSWORD’, ”); // …and password
define(’DB_HOST’, ‘localhost’);     // …and the server MySQL is running on

When we did Part 2, we created a database.  I named mine wp_test.  Hopefully you remembered what you named yours, cause that’s what goes in that first line (if not, you should be able to refresh your memory with a quick run to your local phpMyAdmin).  For the other lines, just copy mine.

Are you running the WP-Cache plugin? If so, let’s make another quick change.  If you have this line:

define('WP_CACHE', true); //Added by WP-Cache Manager

go ahead and change that true to false. Life will be simpler, just trust me.

Final challenge: WordPress stores URL values in the database. Traditionally, we’d have to go spelunking through the Options table to find and change them. However, there’s an easier way introduce in a recent version of WP. We can now override these URL values directly in the wp-config.php file.

define('WP_SITEURL', 'http://localhost/23_testing');
define(’WP_HOME’, ‘http://localhost/23_testing’);

Where I’m using “23_testing”, you’d use whatever directory you copied everything down to earlier. Copy those two to your wp-config.php, I just dropped them after the DB_Host option.

Save the wp-config.php file and let’s see if we have a working site!

First Run

For some reason, I usually find myself at the Default theme after doing all this, so the first thing I do is login and check Presentation and set my theme if necessary.  Your login for the local blog is at:
http://localhost/23_testing/wp-login.php

(again, change 23_testing to whatever folder name you used)

Login with your normal credentials. Check Presentation.
Next, if you’ve been using non-Default Permalinks, swing by Options -> Permalinks and click the “Update Permalink Structure” button.
Finish the tour with a stop at Options -> Miscellaneous and a click of “Update Options”.  That last one seems to help with a fully qualified URL in the options table.  Just easier to click Update than to manually edit the table.

Click the “View Site” link (at the top of every admin page) and admire your work. Cool huh? :-)

Depending on feedback, the next article with either be troubleshooting these first 3 articles or our 2.3 beta upgrade.

tags Tags: , , , , ,

Related Posts Possibly Related Posts

Comments

6 Responses to “Testing New WordPress Versions Part 3: The Files”

  1. the subconscious mind on September 19th, 2007 10:33 pm

    i think xampp is the single most useful tool i have used when testing out plugins with my blog, dont know where i would be without it!

  2. Chris on September 22nd, 2007 10:15 pm

    In general, I think I’d have to agree with you.
    WampServer is pretty slick too…

  3. » pingback » simplerich » 5 Step HOWTO Upgrade to Wordpress 2.3 on September 25th, 2007 5:18 pm

  4. Brock on October 3rd, 2007 11:19 pm

    wow - really great walk-through. I have always been a die hard XAMPP user, but I too am warming to WAMP. - this is really great to see this amount of detail - I’m sure that took some time

  5. Rafa on October 7th, 2007 11:28 am

    ***Traditionally, we’d have to go spelunking through the Options table to find and change them. However, there’s an easier way introduce in a recent version of WP.***

    This made my day! :) I have always had to do this manually in phpMyAdmin but it is a hassle. plus I don’t get this logged in my versioning system! (I use subversion)

    Thanks!

  6. Chris on October 7th, 2007 1:04 pm

    So glad to hear that, Rafa. I think that’s one of the handiest little tricks introduced in quite some time :-)

Leave a Reply




Have you read the Comments section on the Disclaimer page?

About

Wandering the Internet, looking at all things bright and shiny. Playing with many, writing about some. More …

Recent Posts

Recent Comments: