Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Which Wordpress plugin would you recommend to someone with only basic PHP and MySQL skills to back up a quite large WP (engine version 2.2.1) site as safely as possible? The backup should allow redeploying the site with/to an updated, clean install of the WP engine.

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

First of all this question would probably be better placed on http://wordpress.stackexchange.com ...

What to backup

1) database

location: defined in your wp-config.php

For the database many users rely on the WP DB Manager since it automatically performs backups, repairs etc... on the database: http://wordpress.org/extend/plugins/wp-dbmanager/ the advantage is that you access these things from your WordPress panel and it is crontabbed via there. There are also other plugins for this. It keeps various copies of your backupped file, archived and compressed. If you want you can sftp them to your local desktop. The plugin creates a seperate icon "database" and has repair, optimize, info on table usage, you can run queries from it, you can schedule backups and optimizing,

2) wp-content: Template

location: \wp-content\themes\yourtheme\

What is left are the specific files you changed yourself and they will mostly be sitting in the template\theme directory. For this it is easiest to regularly sftp yourself the changes. Ideally you would always first test things on a local install and then put things no production so you would never have to "get things from production" but just in case you hotfixed something there you can always bring it back in that way. It is located under \wp-content\

3) wp-content: Uploads

location: \wp-content\uploads

In here you will find all uploads like images etc... back them up also regularly. Theoretically you could exclude all generated thumbnails since you can regenerate them but that is further optimilization.

4) config

location: root

backup the file "wp-config.php" and the file ".htaccess" in the root of the WordPress directory.

What not to backup

1) WordPress code

location: root, \wp-includes, \wp-admin

For the codebase in general it is something you would not have to version management yourself since it is "3rd party", what you could do is svn it to your root dir and e.g. if your site was hacked update the lot with a new svn run. Here is how to to do it: http://codex.wordpress.org/Installing/Updating_WordPress_with_Subversion

2) Plugins

location: \wp-content\plugins

The plugins idem. Keep a list of them, they are all 3rd party so you do not need to version them yourself. They are kept in the svn plugin dir. If you wrote plugins yourself obviously you already have versioned them. You can also keep a copy of the downloaded plugins but they auto-update themselves.

3) Cache

location: \wp-content\cache, \wp-content\widget-cache, etc...

No need to backup the cache(s)

Of course if you put things somewhere yourself on a weirder place then you need to backup that also IF that changed on production.

(Emergency) FULL Restore

  1. clean the installation dir
  2. run the latest valid .sql script (from the backup) to restore the db
  3. svn wordpresss itself (See above), now you have WordPress back
  4. svn the plugins / copy the plugin directory you kept, now you have the plugins back
  5. copy back the wp-config.php and the .htaccess file
  6. activate your plugins one by one or use an auto-activate-all script (see wordpress.stackexchange.com)
  7. upload the wp-content/uploads dir : now your uploaded stuff is back
  8. upload your specific theme: and now your specific theme is back also

You could/should test the full restore test, maybe locally with a XAMPP installation (http://www.apachefriends.org/en/xampp.html) but before doing the full restore in a test environment you should change in the .sql file some settings to reflect the fact that it is running on another server.

share|improve this answer
add comment

While there are plugins to simplify the process (I dunno to what extent, as I've never used them), you can also do it manually without much programming knowledge (or really any at all).

The first way I'd do it is just to use Wordpress's XML Export function. This is the easiest way to move content from one Wordpress install to another. However, this only backs up posts and comments. You will need to back up your themes, plugins, and uploaded files separately.

Your other option is to just do an SQL dump. If you're using MySQL, then use the mysqldump command:

mysqldump -h [host] -u [user] -p [database] > [filename]

e.g.

mysqldump -h mysql.domain.tld -u foo -p mydatabase > mydatabase-2010-11-28.sql

You'll still need to backup your files separately, but this should also backup your wordpress configurations. Though if you're doing an upgrade, this probably isn't desirable.

You can easily write a shell script or PHP script to perform the mysqldump and file backups (just gzip them to a backup directory) and automate them with a cron job.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.