Coppermine Photo Gallery v1.5.x: Documentation and Manual

Table of Contents

Backing up & Moving

Originally, this section of the documentation was intended for something else (an export feature that later was dropped from the Coppermine package, as it wasn't working as expected and caused more issues than it solved). That's why this page still has got a misleading file name.

This page deals with the related topics how to back up Coppermine and how to move it.

Backing up your gallery

This page is meant to explain how to back up a coppermine-driven gallery.

Backups can be used to restore your gallery somewhere in case something goes wrong (i.e. server hard-drive crash, hacking, own mistake) or if you want to move (move servers, move to another webhost, use another application).

Coppermine stores content both on file system level (i.e. on your webspace - that's the hard drive of your webserver) as well as on database level. Think of the database as a giant array of tables that are connected one with the other. Although the database is (technically) being stored in files as well, you can't just backup the file that represents the database. This is being caused by the way that a database works. Additionally, you usually don't have access to the file that represents the database (but don't start the wicth hunt and try to find it - you wouldn't be able to use it anyway). That's why the backup process needs to be two-fold: you need to back up your files and you need to back up your database. Only backing up one of them without the other will result in an incomplete backup that hardly can be usefull.

File Backup

The backup on file system level is pretty straightforward and you already should be familiar with the technology, assuming that you have installed coppermine in the way the coppermine dev team recommends: using your favorite FTP application. Do not trust buggy tools integrated into WYSIWYG editors. Do not trust wannabe "web-FTP" clients: you need the real thing - a genuine FTP client. If you don't have one already, get one first before continuing.

Complete File Backup

The term "complete file backup" means in this case "a file backup of the entire coppermine gallery". It's advisable to perform this at least once, so you have a full backup for disaster recovery.

To actually perform such a backup, create a folder on your local hard drive first. Of course you need to make sure in advance that there is enough room left on the storage device you use (your internal or external hard drive in most cases) to hold the entire gallery once the backup is done. If you're short on disk space on your client, you could burn the contents of your backup to a CD or DVD once your backup is complete and then free the precious hard drive space once you have copied everything to CD/DVD.

Partial File Backup

If you perform frequent backups you don't have to make a complete file backup each time, as the coppermine core code will (i.e. all the files that make coppermine work on the server) will not change from one backup to the other. That's why you can then perform a partial back, i.e. only the contents of the albums folder of coppermine that corresponds to If you need to perform a restore later, you will have to restore your complete backup first and then restore your partial backup that was created later and therfor is more accurate and recent.

Incremental File Backup

There are nifty tools available from third parties that will perform an incremental backup by FTP, i.e. they will only backup the files that are new or have changed since the last time the backup was performed. This will reduce the time needed to perform a backup dramatically, but on the other hand will make restoring after a disaster a bit trickier - you should only use that option if you know what you're doing.

Database Backup

Coppermine creates during initial install several database tables that are being used to store the content:

There are many other tables that store specific aspects of the content of your gallery - for a complete list of all tables and the structure within them, take a look at the database schema. All relevant tables of a coppermine gallery have the same prefix - the one you chose during initial install. To perform a database backup, make sure to backup all coppermine tables, i.e. all that have the prefix you chose during install. If you're not sure about the prefix, download the file include/ with your FTP app to your client and then edit/view it using a plain text editor (notepad.exe is fine): the prefix should be named there. By default, the prefix name is cpg15x_.

Database Backup: what needs to be backed up?

The wording may differ, depending on the tool and it's version you use to perform the backup, you you need to know what exactly to backup.

A full database backup contains both the structure of the database table definitions (i.e. the "instructions" needed to create the empty tables if they have been lost or need to be created on another server) as well as the data (i.e. the actual table content).

The tables coppermine consists of are not equally important though:

Keep in mind though that coppermine will complain (i.e. there will be an error message) if a table is missing, so you need to create the above-mentioned tables in the first place, but they can be empty.

Database Backup Tools

Coppermine does not come with a database backup tool - you need to find one by yourself and use that. However, there is a list of tools the dev team recommends:

After the database backup

After performing the manual database backup it's important to make sure that the dump you just created works as expected. Therefore, you should really try to open the dump file first and see if it not broken. Ideally, you should perform a restore on a testbed to make sure everything works as expected.

There have been many users already who relied on their backup without ever having tested it once: if you never test your backup strategy, you will never know if it will enable you to perform the restore in case of a disaster. Since there are many things that can go wrong, it's really recommended to test your backup.

Moving your gallery

Your coppermine-driven gallery can be moved around on your webserver as well as from one webspace to the other. Here's how you accomplish those tasks:

Moving on your webserver

Moving your gallery on your webserver (e.g. from a particular folder to the webroot or vice versa) is comparatively easy. Coppermine consists of two components: The good thing about moving your files/folders around is the fact that coppermine does not store the absolute path to a file within the database, but only a relative one: the relative path inside the albums folder). Subsequently, you can move around the folder where your coppermine gallery resides in on your server easily and you won't have to change your database records accordingly.

Just keep in mind that you need to move the entire coppermine folder around, i.e. you must move all files and folders around and not just some of them. The folder and file structure within your coppermine folder needs to remain intact when moving it.

Basically there are two options for this:

Moving from one webserver to the other

This scenario usually applies when switching from one webhost to the other. In fact you create a copy of your files (a complete file backup) and a copy of your database (complete database dump) on the old server and restore those copies on the new server.

You're encouraged to create and maintain frequent backups in case anything goes wrong, so you really should have a backup already. However, if you don't have one, you should create one now. You need to keep in mind that there might be a downtime of your site when moving from one webhost to the other. Ideally, the downtime will be neglible, but you usually won't be able to access the gallery on the old server and the gallery on the new server under the same URL at the same time. Therefore, you need to backup the old server while you still can, i.e. before your old webhosting contract expires and you no longer can access the old server to create the backup. If you don't have a backup and your webserver is no longer accessible you will be out of luck: nobody will be able to help you recover your gallery - it's absolutely mandatory to have a working backup both of your files as well as your database.

Refer to the corresponding ections on this page to figure out in detail how to create the backups.

Below is a summary of the needed steps and some notes on the tricky stuff:

Disadvantages of renaming

There are several disadvantages when changing the URL of your gallery:
  • Bookmarks / favorites of your visitors will no longer apply
  • Search engine indexes will point to the old URIs. Subsequently, you will lose the ranking in those search indexes
Tim Berners-Lee (the "inventor" of the www) coined the motto "Cool URIs don't change" that still applies, so you better think twice before renaming your coppermine folder once it has been established. It's better to choose a clever folder name in the first place (when initially installing Coppermine). Anyway, if you must change the URI of your gallery (or in fact any other URL), you should at least set up some redirector that takes care of the change: on Apache-driven servers (and provided that your webserver supports that feature), you could set up a redirection using a .htaccess file with the redirect directive.

Changing Coppermine's URL in config

Whenever the URL of your gallery changes (i.e. after having moved your gallery around on your webserver or after renaming the folder it resided in), you have to reflect the changed URL in coppermine's config: