Migrainously Migrating Drupal

head

I like Drupal. It’s easy to use, add content, manage users and installing modules. However, I hate migrating an installation from one XAMPP installation to another (or new) one, because I always get errors and problems. I have decided to present my solutions so it may help other non-professional Drupal administrators facing the same frustrations.

I had to migrate a Drupal installation from a Ubuntu machine (LAMPP) to a Windows Vista one (XAMPP) so I was already nervous for the whole operation. In hindsight it isn’t that big of a problem. It always has to do with the phpmyadmin settings so actually it’s not Drupal causing the trouble.

So, I want to migrate a Drupal (export) from one XAMPP installation to another (import). However, installing Drupal causes similar problems every time I try to do so (and I keep forgetting the solutions….)

I assume you already know how to export a Drupal installation (creating an. sql file) and where to import it in another XAMPP installation. I created this walkthrough for Windows, Ubuntu has its usual safety limitations (that is, Ubuntu is much more concerned about safety than Windows), but doing things as ‘superuser’ in Nautilus should also work).

Create a container

  • You need to create an empty database in ‘myphpadmin’ first  to import a new one.
  • Select the database and import your .sql file.

File too large

Once you start uploading your Drupal installation to the new MySQL ( myphpadmin ), the first problem you’ll probably face is:

You probably tried to upload too large file.

You have to change some limitation settings in XAMPP.

  • Go to Windows Explorer.
  • Search for the file php.ini.
  • Open the file in Notepad++ (it’s a free, open source program which you can get here: http://notepad-plus-plus.org/)
  •  Search for the following statements separately  (by using the search option):
    post_max_size
    upload_max_filesize
  • Change the values into something bigger (depending on the size of your Drupal installation):
    post_max_size=8M           ------>      post_max_size=300M 
    upload_max_filesize=2M     ------>      upload_max_filesize=300M
  • Save the file.
  • I had to re-start XAMPP to have the settings work, so re-start XAMPP.
  • Import your .sql file.

Server has gone away

If all goes well you get another error:

#2006 – MySQL server has gone away       (and some more text on top)

  • Drop your imported database (it wasn’t not completed, so it’s useless).
  • Search for the my.ini file within the XAMPP installation.
  • Open the file in Notepad++.
  • Search for “max_allowed_packet”
  • Change “max_allowed_packet=1M” to “max_allowed_packet=64M”
  • Save the file.
  • Restart XAMPP.

Import your .sql file. If you get another error, I can’t help you any more. These were the two errors I got every time I uploaded a Drupal .sql file.

Drupal’s bugging

Next we will probably get an error when we open Drupal (localhost/[nameofsite], this is because you have old server settings in your Drupal installation.

  • Open the settings.php file in Notepad++ (to be found at /sites/default/settings.php).
  • Search for the following block of data:

$databases = array (
'default' =>
array (
'default' =>
array (
'database' => '[database name]',
'username' => '[database username, often 'root']',
'password' => '[databse password, leave empty if you don't have set a password]',
'host' => 'localhost',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
),
),
);

  • Check your information.
    The database name was given when you created a container.
    The standard username is ‘root’, unless you changed it.
    XAMPP doesn’t give a password for your database (although it would be safer to have one!), so leave this empty for the time being.
  • NB: I had to copy/past the file on my dashboard to make changes. Once I was finished I moved it back to the /sites/default/ folder.
  • Save the settings.php file
  • Restart your site (F5 key), it should work now (unless more errors did occur when you created an export).
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s