Portable WordPress

In a recent post I wrote about the benefits of switching to portable applications that don't require installation in order to run — a feature particularly useful when traveling or using a locked down computer. But the readily available suite of such applications wasn't enough for me. I also wanted to be able to make my WordPress blogs portable. And I wanted to be able to update my blogs while not being connected to the Internet. It turned out that this wasn't as easy to do as I expected.

My search began with trials of various so-called offline blog editors. Many of these didn't work without a connection to the Internet e.g. Performancing for Firefox. Others like Qumana and BlogJet had problems working with WordPress's XMLRPC API such that any post with a more tag in it ended up being truncated. So I gave up on these editors.

I then moved on to XAMPP Lite. XAMPP is a suite of portable applications that allow you to run MySQL and Apache with support for PHP from a USB drive. For those familiar with WordPress, you'll know that those three things provide the infrastructure necessary to run a WordPress blog.

The following paragraphs will describe how to get your blog configured to run locally using XAMPP on a Windows-based computer. Please note that I've taken some liberties with the instructions and assumed that you are technical enough to fill in the gaps. Getting in to more detail would make for an even longer post than this one already is.

Set up Your Blog Locally

First off, you need to get MySQL and Apache running. To do this, go in to the XAMPP folder and launch xampp-control.exe. This should open a window where you'll see some start buttons beside MySQL and Apache. Click these start buttons. You can minimize this window now.

There's a folder called htdocs in the XAMPP folder. Copy your blog's files to this folder. I recommend creating a sub-folder to keep things tidy e.g. the path would be htdocs/yourblog/index.php. If you use a redirection plugin such as www-redirect.php, rename this plug-in file so that it won't be used by your local copy of your blog.

Open the wp-config.php file in an editor and keep it open for now.

Create a Local WordPress Database

The default installation of WordPress includes the WP-Backup plugin. Activate this plug-in in your online WordPress blog and then use it to create a backup. You may need to change file permissions to get this backup to work. It'll let you know one way or the other. Once done, download the backup file (which should be zipped) to your local copy of your blog in the htdocs folder.

Use a browser to launch the version of PHPMyAdmin that is included with XAMPP (there's a link to it on the left-hand side of the page that appears when you go to http://localhost). Once loaded, created a database and then import the backup you just downloaded. To avoid future headaches, I recommend you name your WordPress database the same as your web-based one. Use the same username and password too. You can get all three pieces of this information from the wp-config.php file I instructed you to open in an editor a few steps back. And while you're looking at this file, change the DB_SERVERNAME value to localhost. If you want to get fancy, add some PHP code to sense what the web server name is and automatically set the database server name. Save and close this file now.

Once your blog's data has been imported in to your local copy, open the wp-options table. This table contains all the options you've set for WordPress and various plugins. Browse through the records and look for ones where the value is something like http://www.yourblog.com. Change these to http://localhost/yourblog. You should find at least 2 such records that need editing. This change is needed so that WordPress will know to reference your local copy rather than try to go to the web every time you click on a link.

Launch Your Blog

To view your blog locally, open a browser and type http://localhost/yourblog. You now have your blog running locally with no need for an Internet connection. And you have all the capabilities of changing content that you normally have when using your online version. And that begs the question, how do I synchronize my data?

Synchronizing WordPress Data

The first step to synchronizing your data is to read this article which will instruct you to download a program from Webyog.com. Be sure to download the trial enterprise edition which you'll need to install for a short time.

Once the Webyog software is installed, follow the directions in the article for synchronizing two MySQL databases. I suggest setting up a one-way synchronization FROM your web version TO your local version. This'll prevent you from accidentally blowing away data. You'll only be able to synchronize two tables with the trial version. We'll take care of that limitation in a bit.

Also, when given the option be sure to choose the save the job as an XML checkbox. When you have synchronization working and you've confirmed that you saved the session as an XML file, navigate to the Webyog installation direction and copy sja.exe along with your XML file to another location. Then uninstall the Webyog software as you will no longer need it. Note that I'm unclear as to whether the sja.exe is free for use or not. The Linux version is, but the Windows version seems to be available only as part of the bundle.

Open the XML file created during your trial synchronization. A quick examination of this file will reveal that it is structured simply and intuitively. There's a section where you specify the data source, data destination, and the tables you want to synchronize. Modify this file to include a reference to all tables in your WordPress blog except for wp-options. You don't want to synchronize wp-options since you need to have some records different between your local and online versions.

Once you've edited the XML file, you simply run sja.exe file.xml via a command line to get your local copy in sync with your online copy. Ultimately you'll need to create a similar XML file to update your online blog from your local copy.

And there you have it: Portable WordPress. Should I trademark it 🙂

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 4.00 out of 5)


  1. Good articles! You might also check out Uniform Server instead of a paid solution or one that needs configuration. It's free, specifically intended for portable use, is secured (very important), comes with a nice web admin panel and associated tools such as PhPMyAdmin and Eaccelerator controls, and requires nothing more to work than running Server_Start.bat. Shutting down is done via the web admin panel. Nothing to using it, it has never given me an issue of any kind, and it works excellently with Wordpress and Joomla.

  2. Even though I've updated the wp_options table, i get redirected to my live site while testing locally. its not a problem if i do things locally using the dashboard. if i add a post via dashboard locally i dont see it on the live site but if i click on any link in the local site (like when i try to add a comment) i get redirected to live site so my comment gets added to live site instead. I noticed that in the wp_posts table, there url of the links are listed with the live site address. Please let me know if i've missed something.

    • nevermind! i hadn't changed the home field because i had to scroll to the next page of the table to do it, now it works!

  3. I suggest you check out 'Webserver On a Stick'. This software is much easier to use than XAMPP or XAMPP Lite. You'll get WordPress up and running much sooner!

Leave a Reply

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

Notify me of followup comments via e-mail.