hi,

if I install a new drupal on a different server and then I use the backup & migrate plugin, to restore a drupal from another server... is it perfectly restored ?

Or just the database ? Are the modules installed ?

If not, what's the easiest way to copy a drupal website from a server to another ? (with all modules, setting, etc.. a copy 1 to 1) ?

thanks

Edited by WorldFallz - moved to appropriate forum.

Comments

stevenc’s picture

To directly answer your question: If you copy all files in the Drupal installation directory and the entire database (you may omit the content of the cache tables) then yes, it will be restored, and all modules will be enabled.

Notice that I said "copy all source code files". If you re-install Drupal on the new server, then you need to manually re-install the Modules' files, your theme and possibly your "default" directory (if it contains uploaded content). It doesn't really make sense to do it this way, though, if you can avoid it.

The main gotchas with this process:

  • The web server (Apache, IIS, etc.), PHP and MySQL settings can vary on different servers. Be aware of things like aliases, symbolic links, installed libraries, config and ini settings that can impact your Drupal installation. These will not be copied along with your Drupal code because they exist outside of the Drupal directory. Also, you may risk have a different version of any of these 3 things.
  • Backup and Migrate only copies tables within your Drupal installation. By contrast, the MySQL server maintains its own user controls - so, you need to manually re-create the account you are using for your Drupal connection first.
  • Any hard-coded links within your content may break as a result of a new IP or domain address. Normally you use relative links (or use Drupal functions to generate links) but if users are allowed to manage content with hand-coded links, these may break.
  • Drupal's settings.php file will likely need to be updated to your new MySQL connection details, and other possibly other settings.
  • Theoretically, the application -could- store other things outside of the Drupal install. Depending on the server setup and how it's coded, you may need to check for other related content and migrate/recreate it on the new server. This is not a typical situation normally, but it is possible.

After you complete the restore, be sure to flush your cache (Admin -> Performance).

---------------------------------
Steven Wright

Slalom

aneuryzma’s picture

Thanks a lot for the exhaustive answer...

Anyway now it is not clear what's better to do. Should I use backup and migrate module, or should I export and import the database and copy the folders (And adjiust all other parameters you listed) ?

thanks

jaypan’s picture

* export your db using backup and migrate.
* Copy all your files and folders.
* Upload all your files and folders to the new server
* delete settings.php in the sites/default folder
* copy default.settings.php in that folder, and rename it to settings.php (so that you have two files - settings.php and default.settings.php)
* reinstall Drupal as a fresh installation
* enable the backup and migrate module
* use backup and migrate to reinstall the database dump you took in the first step.

That will work 99% of the time. Personally, I've never had it not work, though my local developing environment is quite similar to the one on the servers I use. But if it doesn't work, you have a list of possible reasons why from the above poster.

Contact me to contract me for D7 -> D10/11 migrations.

aneuryzma’s picture

I have one more question: if I copy the drupal folder to remote server, then I have to change the ownership for "files" folder and subfolders right ?

In order to do that, I need to be superuser right ?

thanks