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!
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:
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.
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:
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:
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.
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.
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!
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:
(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.
Possibly Related posts: