Moving A Localhost Site To The Web

102

Lesson Nine of my special Getting Started With Drupal series of videos.

This lesson provides instruction on how to move a localhost Drupal site to a web server. Steps shown in the video include creating a domain, creating a web database, exporting the local drupal database and importing the exported database to the web database.

The premium version is a full resolution (1024x768) version that contains additional content as indicated below.

Premium Content: 
  • Uploading new settings.php file
  • Turning off comments and user registrations
  • Reviewing content for errors
Bookmark and Share Bookmark or Share Post

Comments

Anonymous's picture

Moving to new DB

Nice video, it was a big help. One thing that got me though, the sql file created by the export command contained create database and use database sql statements at the beginning of the file.

Two problems here, one the database name in these statements is the name of the old database (the one being dumped). So if you created a new database with a different name you'll run into problems.

Second my hosting site, also Dreamhost, does not allow databases to be created via sql statements you have to create the database via their web panel. If you do execute a create database sql statement, which will happen when the dumped file is imported, you will get a permissions error. Just delete (or comment out the two statements before importing it) Took me a while to figure that one out.

regards

RobertSafuto's picture

I haven't had the problems

I haven't had the problems that you mentioned. I don't know if phpmyadmin ignores the "create database" or not but it hasn't effected me in performing something like this multiple times.

I'm on Dreamhost as well and I do create the database via their web panel. Then I upload the sql dump from the local database but I've never gotten a permissions error because of that.

Anonymous's picture

Strange

Thats strange. Dreamhost even addresses this problem (which is were I found the solution) at http://wiki.dreamhost.com/Migrate_MySQL (scroll to the bottom of the page section "Access Denied').

Do you have a phpadmin created sql dump file around or can you create one? If so does it contain the 'create' database sql statment ? Maybe some versions of phpmyadmin don't add the create database sql statement.

Anyway its something to be aware of, and again thanks for the info re: moving a drupal install.

Ps. Just had a thought, I'm on OS X, it looks from the video your on Windows, right? If so perhaps phpadmin behaves differently on each platform.

Anonymous's picture

Quick question for

Quick question for you:

Trying to access the local host (http://localhost/phpmyadmin) in order to export the data base...

However do you think I can remember the user name and PW?

Any way to reset, retrieve, or bypass the need for this?

Anonymous's picture

Thank you very very much regarding the "Access denied"-hint!

Thanks a lot for sharing this video, very helpful work! Not only this particular video but all your other videos as well! Thank you!!

And also a BIG BIG "Thank you!" to "Anonymous" (postings from 03/24/2009). I was working for hours and hours with the mentioned problem and just now read your posting and whupp: problem solved. Thanks very very very much for sharing this!!

Anonymous's picture

I keep getting problems when

I keep getting problems when moving my localhost site to the web, regardless of the free host I choose.

I upload all my files via Filezilla to public_html, create a database, change my settings.php, upload that file, and still....errors.

It's normally this one:
Fatal error: Call to undefined function privatemsg_title_callback() in /home/********/public_html/includes/menu.inc on line 500

I've tried 5 different hosts now, and Google'd till I give up, it's become quite frustrating.

learnbythedrop's picture

Problems Moving To Web

It's probably something in php that your host doesn't have turned on or doesn't support. Either way at the very least you'll be better off getting a new host. Based on this post (http://drupal.org/node/445566) it looks like you've been trying free ones which are likely to have limited features.

Anonymous's picture

Robert, Thanks for the

Robert,

Thanks for the tutorials - I found them very handy. As I get better and more advanced in drupal, I will definitely be reading more of your stuff...going to try the upload from my localhost to bluehost tonight...

thanks again - you really helped me understand what it entails!

Anonymous's picture

Some of the links are still in the database

Hey There,

Great tutorials by the way.
But have a little question over here, i moved my drupal database like you did but had the problem that some of the urls containt the local path in it. If you search youre file you see it. Or maby it where some of the module i use. How can i fix things like this? Is the base_path in the settings file for this. And does drupal fix it self in time?

Thanks!

Greetz

Anonymous's picture

Some additional tips

Hi Rob, even I do have some experience with transferring Drupal Sites, I appreciate
very much your Video.

Allow me to add some tips for users that just want to exercise first with this task.
It's not necessary to backup into the .sql file some tables contents, like

1. accesslog
2. cache (and all the possible types of cache tables
3. watchdog

So you may empty first those tables before you backup with phpMyAdmin.
This can first help you to control the size of the .sql file and also avoid
to have old and incorrect data transferred to your host.

Hope this could be useful to know
Regards

Anonymous's picture

Content not displaying

First -- Thank you so much for all your videos!

I was having so many problems trying to move my database from mamp to the website. I was even following a tutorial done by another person and it just wasn't working. With your tutorial, I saw that I was missing a few steps. Now that I've followed your tutorial the site is working fine, but I'm missing my content. All the page content, navigation links etc. Any ideas on what I did wrong?

learnbythedrop's picture

Missing Content

It sounds like there may be some kind of disconnect with the database since that's where the content is stored. I'd check a couple of things. First, double check that ALL of your local files have been uploaded. Sometimes the .htaccess file is hidden by the local system and not uploaded. Sometimes we make a mistake and miss uploading a folder. Second, look at your database tables using phpmyadmin (or a similar tool) and make sure that all of the tables are present. It's possible that a table didn't get exported properly.

I've never had this specific problem but those things are what I always check first if there's a disconnect when transferring a site.

Anonymous's picture

Missing Content

I went to my hosting company and discovered that they have a strange way of handling databases. The database needs to have the cpanelusername_databasename, and the user is cpanelusername_databaseuser. I was just using the username and database. The local host is not my website name, but some other random name that they assigned me.
Silly me. If I'd gone to them first it would have saved me 2 days worth of pulling my hair out.
:-)

eword's picture

home page, but nothing else

well, another day, different problem... (after i too experienced a similar problem to the last poster, with my host doing something similar with the url for the database - but lucky for me i figured it out on my own in an hour).

but now i have another problem... i go the site to show up, well the home page at least, but nothing else... any link, including trying to log in, etc. just triggers the hosts "page not found" page.

i tried the thing with the htaccess file, and that did not work (side note: when telling people a hidden file may not have gotten copied - might want to state where the hidden file should be found, i mean, you are looking for a hidden file afterall!)

as it turns out, the host i use has a built-in drupal install tool, but i am loath to start over a third time, to recreate the site all over again (and i am not sure aout how to graft the site i have created locally into a new installation without encountering the same problem in the end anyway.

anyway, thanks if you can be of any help... i really did find the tutorials helpful, and now think you are very brave indeed to even put out this series. you must get bombarded!

eword's picture

turn off clean urls!

ok, solved my own problem (with a lot of effort!). and to help others avoid a similar fate... Disable Clean URLs before exporting the database and uploading the site (then re-enable them once the site is uploading and working.

discovered this "best practice" for when moving from a local to a production site combing through the drupal site, which i found only by lucky chance because the person who originally had the same problem just happened to use the same host as me (and that is the only reason i came to that post through my search.

cheers, all, more lessons to go (hopefully i won't be back!)

Anonymous's picture

Odd Menu Structure

I have followed your tutorial and everything seems to be transferred fine however once my site is live, odd menu items appear in the navigation. An image of the items can be found here: Odd Menu Items

My original site was made in a subfolder called Drupal, i.e examplesite.com/drupal/ but the transferred site directory I am using is just examplesite.com. I am also using a different db name to the local server one, but this is also what you do in your video. Do you have any idea why this strange menu issue is occurring?

Regards,
Jason

learnbythedrop's picture

I would check a couple of

I would check a couple of things. If you switch to the Garland theme do you still see the strange menu items? If not then maybe its a theme issue. Do you have any menu related modules that you have enabled? One of those might be causing the issue. Can you see the menu items included when you look at the administrative view for the menus? If so perhaps you can disable them.

Anonymous's picture

Clean Urls

Robert,
Your lessons were excellent. I'm almost computer illiterate, but Drupal 6.13 is now on the web. Domain: ga-le.de. Provider one.com.
Technicians from my provider told me Apache Server rewrite_module is turned on.
However, the .htaccess-file which is in the original Drupal Download is not compatible and does not operate with my server. The above mentioned technicians offered me a - very small - .htacess file and Drupal runs fine with the exception of the clear urls. :-( After studying drupal.org pages and without understanding Apachian-language, I tried the following .htacess file which is a modification of the technicians' file and added what I hoped to understand at drupal.org:
"# Options -Indexes
# Options +FollowSymLinks
# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

order deny,allow
deny from all
allow from all

order deny,allow
deny from all

"
No explosion, no smoke, Drupal was operating well, but the urls remained dirty.
What has to be in the .htacess-file so that all works fine & I have my urls clean?

Jan Brägelmann
Leipzig, Germany

Anonymous's picture

Problem solved

I've my clean urls with following skript.

"# Options -Indexes
# Options +FollowSymLinks
# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

# Various rewrite rules.

RewriteEngine on

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]

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

order deny,allow
deny from all
allow from all

order deny,allow
deny from all

"

Anonymous's picture

localhost or yourdomain.com

Thanks again for another clear, detailed video Rob.

I'm in the middle of moving a website from localhost to my host a2hosting.com. I've already done it successfully with a previous website, but forgot some of the details. I was surprised to see you suggest changing 'localhost' to my domain in the settings.php. I have always left 'localhost' with my previous websites. When i followed your suggestions i got an error message.

learnbythedrop's picture

Settings.php When Moving Domain

It could be something specific to your hosting company. I have always set the domain so it could work on my host which is Dreamhost. In general I would say to stick with what works for you since web hosting is definitely not a one size fits all type of service.

Anonymous's picture

questions on changing settings.php log

hello, Robert

Thank you for this tutorial video!

I'm making my very first website with drupal 6, and I'm using dreamhost as my web server. I'm unfamiliar with web-making, and so this video has been a big help.

I followed your instructions, and got everything uploaded on web server - but when I go to my website, I get this message from drupal:

"Site off-line. If you are the maintainer of this site, please check your database settings in the settings.php file and ensure that your hosting provider's database server is running. For more help, see the handbook, or contact your hosting provider."

I'm guessing the changes I made in settings.php was incomplete or wrong... i used my username and password that i use to access the phpadmin for my website address.

My settings.php looked slightly different from the one you showed in this video (please see, this) Boxed line is the one i changed - is this the right place?

Thanks for your help!

learnbythedrop's picture

Database Settings

One thing I notice is that your database settings are on the mysql variable "$db_url = 'mysql:c//" rather than "$db_url = 'mysql://" which I use on all of my sites. The first thing I would do is double check to make sure that the database location and password in the settings.php file are correct. I'd also move the hostname, username and password to the "$db_url = 'mysql://" setting and see if that makes a difference as well. If neither of those helps with the issue it may be worthwhile to see if your web host offers a support knowledge base or forum where you can get help with issues related to Drupal. Sometimes the issue has to do with special configuration required to meet the standards of a web host.

Anonymous's picture

Great!

I have been looking for this information for the last two weeks and finally found the solution in your video!
Thank you so much!
I just wonder why it has to be such a hassle to do something so straight forward like uploading your page from local to remote server!?

Anonymous's picture

Would i need to install drupal again on the hosting service

I have followed all the instructions in the video but the hosting url shows me the drupal install page - would i need to install drupal again?

learnbythedrop's picture

It depends. Did it show the

It depends. Did it show the install page even after you edited the settings.php and uploaded the local database?

Anonymous's picture

directing all the data to the domain

Hello,

I followed all the steps in your video, and successfully moved my localhost site to the web. Thank you!

I still have one thing I need to figure out:
My site is on the web, however, everything is on "www.mydomain.com/foldername", rather than just "www.mydomain.com".

What do I need to do to have my website shown right at www.mydomain.com?

I used Cyberduck to upload all my files for the website. - at first, i uploaded the folder (which contained all of my files for the website) itself to the web from htdocks on MAMP.
Then I realized that was causing this "www.mydomain.com/foldername/" problem, so I moved every file out of the folder.
Yet when I access www.mydomain.com, nothing shows up.

Is it my drupal setting? Do I need to rewrite the directory in site>default>settings.php?

p.s.
Thank you for commenting on my previous post. It helped me a lot!

learnbythedrop's picture

.htaccess file

Did you move the .htaccess file to the root of the domain? Many programs hide the .htaccess file by default. And if that doesn't get moved to the root directory then you won't be able to access the domain. Check the folder that you copied the files from and the root directory to make sure that the .htaccess file is where it is supposed to be in the root folder of the site.

Anonymous's picture

Homepage showing but nothing else

I've uploaded my site to a new server, configured the database and everything was looking great on the homepage, until i clicked something.

For some reason, nothing is displaying apart from the homepage. I can't even access /user.

It seems that it is accessing both drupal & the database, because the homepage is displaying perfectly, but that is it.

Any idea what might be causing this?

Anonymous's picture

index.php?

help please!

i used your tutorial to transfer from wampserver to my web server and i am getting this error message when i try and use it.......

Unable to open WampServer's config file, please change path in index.php file

have you any ideas please can anyone help me??

learnbythedrop's picture

It sounds to me like you did

It sounds to me like you did something wrong. You shouldn't be getting a wampserver message when you're running Drupal from a web server. I'm assuming that when you say "web server" you mean your web host. I recommend to take a look at the video again and double check the steps.

Anonymous's picture

Advertisement before video

FYI...

The advertisement before your video does not finish before your video starts playing, so you are talking as the advertisement is still talking.
It is about 20 - 30 seconds that is affected.

Just a simple FYI...

learnbythedrop's picture

I'll check that out. You can

I'll check that out. You can always click the download link and watch it locally without ads.

Anonymous's picture

ok i need help some how i

ok i need help some how i build a site out of drupal and i wont let me log in or password what should i do it keep say the CAPTCHA field is required

learnbythedrop's picture

No Clue

I would love to help but I really don't understand your situation. If you forgot your password you can have the system reset it by email.

Post new comment

Important
All comments on this site are moderated to prevent spam. Although we also use the Mollom module we have found that some gets through and that also affects people who have subscribed to email notifications. If you would like your comment to appear immediately please login with Google Friend Connect which supports your Google, Twitter or Yahoo account.
Google Friend Connect (leave a quick comment)
Loading
The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.