Composr Tutorial: Moving sites
The Composr quick installer handles all the work to installing Composr on a server automatically. However, if you choose to move to another server, some of this work will need to be re-done. This tutorial will explain the issues involved here.
This tutorial is written around moving servers. If you are moving hosting accounts within the same server you can follow the same process. If you are merely changing URLs within the same hosting account then all you need to do is move the files (if appropriate) and change the base URL setting (see "Changing URL").
IntroductionThere are two fundamental parts to a Composr site:
- The files
- The database
To copy to another server/hosting-account, you would need to copy both.
FilesComposr has an enormous number of files. The quick installer extracts all of these to the server so that you do not need to be concerned with transferring them individually.
The good news is that most webhosting control panels come with high quality file managers. To transfer files follow the following process:
- Log in to your control panel in the old server.
- Proceed to the file manager.
- Zip up the contents of the directory Composr is installed in (it's best to ZIP up everything within the directory via mass-selection, rather than zipping the parent directory).
- Download the ZIP to your machine.
- Upload the ZIP to the new hosting preferably using SFTP/FTP (using a file manager is very likely to time-out). Put it in a place equivalent to where it was generated on the old hosting.
- Log in to your control panel in the new server.
- Proceed to the file manager
- Unzip the ZIP file.
If you are a very advanced user you can avoid steps 4-8 by directly transferring the ZIP from one server to another and unzipping from the shell. This is beyond the scope of this tutorial, however.
File permissionsOnce files are transferred, you need to replicate the correct file permissions so that Composr can continue to function. File permissions are rarely transferred when actual files are transferred, due to the relationship between permissions and ownership credentials and the differences between ownership credentials on different servers.
If you are on a suEXEC-style server you can bypass this section. Most users nowadays are.
If you have 'shell access' on your new server, typing the following from a shell inside your Composr installation directory will quickly fix your permissions to what they should be:
chmod +x fixperms.sh
If you do not have such access:
- Try asking the webhost to do it
- You can get Composr to set the permissions for you using a special feature you'll find in the http://yourbaseurl/upgrader.php script.
- If all else fails, you need to change any permissions described in the Advanced installation tutorial and any files that were created/uploaded during running the site. This could be incredibly time-consuming, so is not recommended.
Database contentsAlmost your site data is stored in the database so it is crucial that database contents is backed up, transferred, and restored, to the new server.
Backup is best done using the shell, via the mysqldump command.
mysqldump -uusername -ppassword database > filename.sql
If you can't use the shell
Reasonable webhosts allow you to directly download an SQL dump via phpMyAdmin. mysqldump is preferable as it is more reliable, but phpMyAdmin usually works. Be aware though that bad webhosts pretend to but it ends up timing-out with an error message and/or a truncated file.
Upload the SQL dump to your new server using SFTP/FTP.
Restoration is then best done via the mysql command:
mysql -uusername -ppassword database < filename.sql
If you can't use the shell
If you don't have shell access to import a database you'll probably end up using phpMyAdmin again to restore. However you will struggle to import large databases with this, as it is much more problematic restoring than backing up. You may therefore find this tool useful: http://www.ozerov.de/bigdump/.
If the new database settings are different to the old ones, you will need to use the http://yourbaseurl/config_editor.php script to update your Composr settings (or edit _config.php by hand).
You may need to update the following settings:
Changing URLIf you are moving URLs, then you need to use the Installation Options editor (the http://yourbaseurl/config_editor.php script) to change your base URL setting. Composr automatically will clear out your caches if it sees the base URL has changed.
CachesYou should clear the block cache from in the http://yourbaseurl/upgrader.php script.
- Uninstalling Composr from a server
- Advanced installation
- Backing up your site
- Cloning your site
Have a suggestion? Report an issue on the tracker.