Trying to migrate a development site to a live site

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
pkcho's picture

I'm trying to move my development site to a live site and am following Nicole Bluto's Drupal LA seminar notes on "Migrating a Site from Stage to Live".

I've exported my databased using the Backup and Migrate module.
I created a fresh drupal install on the live site.
I've copied my "sites" folder from the development site into the live site.

At this point she says to create a new database... can I not just import my exported database into the fresh install?

Also, she says to alter the settings.php file at line #92

$db_url='mysql://username:password@localhost/databasename';

I replaced the 'username' and 'databasename' that is there with the right information, but have no clue what the new "password" should be. I have no idea how the password that is currently there was derived.

Any help would be greatly appreciated. Thank you.
Joe

Comments

you'll need to create the database

rainbreaw's picture

Hi Joe -

You'll need to create your database in the live environment, which is when you'll set the password. Once you create the new database, you can then Import (hopefully you have access to phpMyAdmin or somethink like it) the data from your stage site into your live database.

The slides that Nicole and I put together for the presentation actually walk through setting up your database on live. You can download them from this page:

http://www.sunrainproductions.com/drupalcampla/site-migration-basics

Scroll to the bottom and click on the attachments for the Slideshow and the Outline.

Hopefully that will get you through this step.

  • Rain

finally got it

pkcho's picture

Thank you for your reply.

The outline is very good, after about 5 attempts I finally got it right. I didn't take a look at the slides that might have saved me a ton of anxiety : )

Part of my problem was with my lack of familiarity with my hosting's phpadmin. Once I figured out how the database, username and password were listed in the phpadmin and correctly put that information in the settings.php file, it worked!

Thank you for your response.
Joe

glad you got it!

rainbreaw's picture

Migrating a site is one of those things that is unnecessarily stressful the first time, and then very easy after you get used to it. One day very soon you'll forget your anxiety! :) I'm glad you got it working. Congrats on launching your site.

Hello, Signal, for the

wabowabo's picture

Hello,

Signal, for the password you should write the database access password which is used by db user (username). This is either setup with your hosting account, or if you have created a new db with new user, then you should have also created a password for that user.

Also, make sure to check your mysql host information. On some hostings it is localhost, in some cases (like with Dreamhost, that i am using) it is mysql.mydomainname.com. Other hosting companies might have their own mysql servers; usually it is something like mysql461.yourhostingcompany.com.

Hope this helps.

Regards.
WaboWabo

Hello, Signal, for the

wabowabo's picture

sorry duplicated entry. removed

When I transfer from a

_gramur's picture

When I transfer from a development site to a live production site I tend to use the Backup & Migrate module. I would just do a fresh installation on the live site, transfer all the necessary modules and themes and use the backup and migrate tool to transfer over the database, it does the trick for me, the only thing is if you have images you need to copy those over onto the live site.

There may be other methods but this method works for me. I suggest you give it a try.

Thank you

pkcho's picture

Thanks wabowabo and gramur for your replies. As I mentioned above, my problem was my lack of familiarity with my host's phpadmin and being new to the Backup & Migrate module, I was a bit anxious. Everything worked (with a little hiccup), but better than could be expected.

Thanks,
Joe

backup & migrate module size limit?

Slurpee's picture

Anyone else notice the backup and migrate module doesn't work with databases that are too big?

I haven't done too much research. I tried exporting a 500 megabyte mysql file and it always timed out. I had to use the mysql command line to migrate.

host timeout settings

rainbreaw's picture

This could be a function of your host timeout settings or your max_execution_time as well. This node: http://drupal.org/node/285337 or some like it might help. I haven't dealt with a database that large, however, so I'm not sure if this will be of any help.

max_execution_time will be a

djudd's picture

max_execution_time will be a factor in the backup completing, but another factor could be the tables you're backing up.

I really recommend that you don't back up your cache tables or session tables. They can be huge, and the backup module can choke on them.

Also, as an aside note, if you are using the Search module on a site with a lot of nodes, that can really make your database huge as well, and give you issues with doing a backup through the module. I am no longer using the search module (I replaced it with a custom search in views which keeps CPU load down), but when I did use it, I had to exclude all the search tables in my backup as well.

Realistically, I found it was far better to rebuild my entire search index than to try and explain to my boss why an import of our backup was going to take 8 hours anyway. Publishers don't often like the idea of a site being down for 30 seconds, let alone all day while the search index table imports.

Need Help: Importing Live -> Test

shirleyto's picture

Hi,

I'm trying to do it the other way around --- to import the live site into a test site. I did the database import and the first page shows up, I can log in as the admin and I can get to the admin page by doing /?q=admin in the URL, but clicking on anything else (such as admin/settings/language) results in "page not found"... What am I missing here?

Thanks a lot.

-shirley

check .htaccess

rainbreaw's picture

Check to make sure your .htaccess file has also been moved over. Sounds like it might be missing.

Still Battling...

shirleyto's picture

Hi Rain,

Thanks for responding.

Ok, the file was indeed missing and I copied the .htaccess file over, but it's still doing the same thing. My drupal site is in a sub-directory of the main site, and the .htaccess it at the root of the main site and it doesn't seem to contain any access related info on the drupal folder. I took a look at settings.php and updated $base_url and $cookie_domain to point to my test site but it still doesn't work........ What else should I look at?

Thanks.

-shirley

Take a look at your apache

johsw's picture

Take a look at your apache configuration - especially allowoverride

http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride

Best,
/Johs.

.htaccess needs to be in Drupal directory

mike stewart's picture

pretty sure it's just your .htaccess file. .htaccess should be in the Drupal root directory - I think that should help.

ooops missed rain's comment. also clear your caches.

--
mike stewart { twitter: @MediaDoneRight | IRC nick: mike stewart }

From your comment, it sounds

rainbreaw's picture

From your comment, it sounds like you don't yet have the .htaccess file that comes with the Drupal files in the directory that your drupal install itself is in? You will need to have that special .htaccess file in there as well.

The default content of the file you need is this:

#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch ".(engine|inc|info|install|module|profile|test|po|sh|.sql|theme|tpl(.php)?|xtmpl|svn-base)$|^(code-style.pl|Entries.|Repository|Root|Tag|Template|all-wcprops|entries|format)$">
  Order allow,deny
</FilesMatch>

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.php

# Force simple error message for requests for non-existent favicon.ico.
<Files favicon.ico>
  # There is no end quote below, for compatibility with Apache 1.3.
  ErrorDocument 404 "The requested file favicon.ico was not found.
</Files>

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
  # Enable expirations.
  ExpiresActive On

  # Cache all files for 2 weeks after access (A).
  ExpiresDefault A1209600

  # Do not cache dynamically generated pages.
  ExpiresByType text/html A1
</IfModule>

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # If your site can be accessed both with and without the 'www.' prefix, you
  # can use one of the following settings to redirect users to your preferred
  # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  #
  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/... will be redirected to http://www.example.com/...)
  # adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} ^example.com$ [NC]
  # RewriteRule ^(.)$ http://www.example.com/$1 [L,R=301]
  #
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
  # (http://www.example.com/... will be redirected to http://example.com/...)
  # uncomment and adapt the following:
  # RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
  # RewriteRule ^(.
)$ http://example.com/$1 [L,R=301]

  # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  # VirtualDocumentRoot and the rewrite rules are not working properly.
  # For example if your site is at http://example.com/drupal uncomment and
  # modify the following line:
  # RewriteBase /drupal
  #
  # If your site is running in a VirtualDocumentRoot at http://example.com/,
  # uncomment the following line:
  # RewriteBase /

  # Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

# $Id: .htaccess,v 1.90.2.3 2008/12/10 20:04:08 goba Exp $

still no luck...

shirleyto's picture

Thanks Johs and Rain.

Rain, you're right about the default .htaccess from Drupal install, I copied it over but the problem is still there...

Johs, I did check the Apache config, "AllowOverride" is set to "All"...

Might be some silly/fundamental I'm missing.......?

-shirley

check the permissions on .htaccess

bvirtual's picture

The file must be readable by the userid of the web server daemon, maybe "apache", or just chmod 666 .htaccess to be sure. You can also put a typo, a syntax error into the .htaccess and see that apache generates an error log entry for this. Thus, you know apache is reading the file then.

FYI: The cp command of unix will not copy hidden files starting with a dot.
So, use tar and then untar, to get everything, in the entire folder subtree.

Peter

LA's Open Source User Group Advocate - Volunteer at DrupalCamp LA and SCALE

.htaccess proper folder

bvirtual's picture

You say you put Drupal into a subfolder of the web root. The .htaccess file must go into that same folder, not the web root folder. .htaccess goes in the same folder as index.php is in. And README.txt and update.php.
You might post a directory listing of the Drupal folder?

It sounds like you might be on a remote host? Using FTP, so that file listing would be hard to create?

Is the computer running the test site you are trying to get working Unix? Windows? Mac? Do you have ssh access? Command line? If so, then a directory listing can be made with

ls -la >lsla.txt

and post the contents of that file.

Peter

LA's Open Source User Group Advocate - Volunteer at DrupalCamp LA and SCALE

What do the URLs look like before you click on them?

Adam Gaffin's picture

I've had that happen in a similar migration. The answer in my case was to go to ?q=admin/settings/clean-urls and enable clean URLs.

win to lin ?

maaak's picture

I have my dev site in a windows enviro (wamp server) my live site is on a linux server, will this work ?

Try Migration Magic!

WebDesires's picture

Hello,
Why not use Migration Magic - it gives you a nice clean GUI for managing your live / development environment and allows you to see what files are changed, you can do a DIFF to see exactly what in the files have changed and then simply click and migrate files between your test and live environments.

http://migrationmagic.co.uk

Need Drupal help and support?
https://webdesires.co.uk

Newspapers on Drupal

Group organizers

Group categories

Topics - Newspaper on Drupal

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week