Feeds:
RSS
Atom
RDF

This article tells how to migrate TYPO3 installation to another server. It assumes that you are in charge of the server. If you use shared hosting, it may be harder to migrate because you do not have anough control. In short migration consists from the following parts: 

  • Migrating files
  • Transferring the database
  • Recreating directory structure
  • Updating the installation

Let's see these sections in details.

Migrating files

To migrate files, archive the following directories:

  • fileadmin
  • uploads
  • typo3conf

The rest will be recreated on the target server.

Transferring the database

Your source and target web servers should have the same character set and collation settings. You can view them using mysql command line utility:

show variables like 'character_set_%';
show variables like 'collation_%';

If these settings do not match, my.cnf settings on destination server should be adjusted. If changing my.cnf settings is not possible, you can put adjustments into setDBInit in Install tool. For example, to convert server fully to UTF8 for the current session, do:

SET NAMES utf8
SET SESSION character_set_server=utf8

The first command changes all settings except character_set_server. The second one changes settings for server. If that stays latin1 (not UTF8), most likely you will get weird errors (like "Field was not properly updated in the database") when saving records with non-English characters.

To backup database use the following command:

msqldump -u user -p --create-options --default-character-set=utf8 -K -e --opt -q database > database.sql

Options in italics are depended on your system.

When importing database on the target server use mysql utility with the same --default-character-set option:

/var/www $ mysql -u user -p --default-character-set=utf8
mysql> source database.sql

Recreating directory structure

Create directory structure as described in "Installing TYPO3 with upgrades in mind". Additionally create the typo3temp/ directory and any subdirectory in it that you had on the original server. There is no need to copy files from typo3temp/ to the new server. Unarchive files from the old server receating directory structure.

Change directory permissions on target server. Assuming that Apache group is apache, do the following:

sudo chgrp -R apache fileadmin typo3temp typo3conf uploads
sudo chmod -R g+wX fileadmin typo3temp typo3conf uploads

Notice the large "X". It means that permission is applied only to directories, not ordinary files.

Updating installation

Change database settings in typo3conf/localconf.php. Login to TYPO3. Go to Install tool and review basic settings. Set up ImageMagick directory and sendmail path if necessary. Check database using Database analyzer's COMPARE function.

Clear frontend cache. This is necessary because all images from typo3temp should be regenerated on the new host.

Verify that site works properly.

You are done with moving!

Like it? Then bookmark it! digg.comdel.icio.usgoogle.comMyLink.deYahooMyWebTechnoratiFurllive.comnetscapeTagThatWebnews

5 Comments

  1. on Thursday, 05-06-08 12:42 François Suter
    Good trick with the capital "X"! I didn't know that one.
  2. on Thursday, 05-06-08 13:34 eater
    I usualy add few lines to .htaccess file, like 301 redirect non-www to www, so I have to copy this file too.
    Thanks for the article.
  3. on Thursday, 05-06-08 22:28 Thomas
    Sometimes an alternative could be to make a package:
    http://www.fi-ausbilden.de/blog/2007/06/24/typo3-package-selber-bauen/
    (sorry, it´s in german...)
  4. on Friday, 06-06-08 11:57 Typo3 Klagenfurt
    Oh thanks for this artikel - i have last week a problem with a migration!

    Thanks
  5. on Sunday, 22-06-08 05:18 Asfahaan
    Do I need to empty the cache in the database before taking a backup? It gives me an error when import the sql using phpmyadmin.

    Also how do I empty the cache tables?

    THanks,
    Asfahaan
    asfahaan@gmail.com

Leave a Reply