Tried and True - Steps to Migrating Drupal from a Testing Server to a Live Server

Submitted by admin on Wed, 01/18/2012 - 10:50

After having torn my hair out trying to get a smooth site transfers from a testing server to a live server, I've finally given up and just decided to write down the steps as they go and are completed correctly.  Some things to take note of are that I use cPanel for a live server, and MAMP on a Mac for my testing server.  Also I use CyberDuck or Filezilla for FTP (which ever decides to work better at the time).  These steps may still help you if you use different programs, but just be ware that things could also be quite different.

  1. Back up everything!  You can upload a module called backup and migrate which can help with this.
  2. Make sure that your css, theme and layout is the way you want it.  While you can still make CSS tweeks after the migration, it's much easier on a testing server.
  3. Check that all of your modules are up to date.
  4. Set your site into maintence mode. www.yoursite.com/username/settings/site-maintenance 
  5. Turn Clean URL's off. www.yoursite.com/username/settings/clean-urls  will become www.yoursite.com/?q=yourusername/settings/clean-urls
  6. Turn off all of your modules, write them down as you do...
  7. Create a new database on the live server.  I use cPanel.  These operations will vary depending on your hosting provider.
    • Login and select MySql Databases.
    • Create a database with the relevant name and take note of the full name. It should be something like:  yourCpanelUsername_dbName.
    • Create a new database user, add them to the database and grant them full privilages.  Once again take note of both the name and password. 
    • Once you have created your database, go back to the main cPanel page and click on phpMyAdmin.
    • You should see your database there.
  8. On the testing server... I use MAMP.
    • Find your database.
    • Export it in a zip format.
  9. Now import the zip file to your live database.
  10. Change your settings.php file: Line 91 -
    $db_url = 'mysqli://new_username:newpassword@localhost/new_database';
  11. Move your site's files using an FTP client.
  12. Go to the domain (make sure that you have set the domain up properly- for example if it's an addon domain, make sure that is has been added...)
  13. Go to www.yoursite.com/?q=yourusername/settings/clean-urls and turn the Clean URL's back on.
  14. Go to http://www.yoursite.com/yourusername/build/modules and turn your modules back on.
  15. Check every page to see that all the pictures and content is correct.
  16. Turn the site-maintence mode off. Check everything again.  Then check it again.
 

copyright Dirt Bird Productions 2011 | Site Design and Development Dirt Bird Productions 2011