Moving A Localhost Site To The Web

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?

Glad I found this!'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!!

Tdkimmel'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.

FO'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

David Naian'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

Tamela Buhrke'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.

Tamela Buhrke'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!)

Jasont'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.

Jan Brägelmann'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

Jan Brägelmann'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.

tomo'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.

Stefan '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?

tomoe'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.

james'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?

kobestarr'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.

shyiceballer'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.

Sylvain Paquin's picture

Re: Moving A Localhost Site To The Web

Hi, I followed the whole instructions from the video but I rann into some issues. It looks like that after moving my site I lose all information about my Themes and Modules. The settings.php file must be ok since it does load my content. I couldn't access the /user page but after deactivating the Clean URLs, I was able to. Reason is, the site can't see any modules, including the pathauto one, that's why deactivating the Clean URLs enabled me to access the whole site's content.

The only difference I can see is that in MySQL, the 'system' table seems to revert to a default version of it. Therefore it loses all the information around the modules/themes. Even when I re-import that table, I can see that it takes it, but browsing the site reverts the system table to it's original state. Anyone encountered the same issue ? What could cause this and how could I resolve it ? Thanking you in advance...

Sylvain Paquin's picture

Re: Moving A Localhost Site To The Web - Resolved

Just found out what the issue was... My site when running locally on my PC using WAMP server, it accepted the folder names 'Modules' and 'Themes'. My host sees it as different than 'modules' and 'themes'. As soon as I change the folder names, my site was functionnal. Talk about wasting countless hours to resolve a silly issue...

Rocio's picture

Re: Moving A Localhost Site To The Web

Hello, thanks for your tutorial, really helpful.
I have a problem though, it keeps on showing that my site if off-line due to technical problems, and every time I try to upload de settings.php (with the due changes), it shows a warning saying that it cannot find the /sites/default//_notes/dwsynk.xml. Any ideas about this?
Thank you

learnbythedrop's picture

Re: Moving A Localhost Site To The Web

I'm not sure what that error is about. Your site is trying to find a path with a space in it which is very curious. Double check your settings.php for a reference to hat string. Also check to make sure you have uploaded your .htaccess file.

Anonymous's picture

Re: Moving A Localhost Site To The Web

I used the Acquia Drupal stack to create my site offline.
To get in onto my Dreamhost domain, do I FTP transfer the entire Acquia Drupal file from my hard drive?
I am pretty illiterate with this stuff, and in the video you simply say "we will now transfer our files", but I am jun not sure whihc files! I am now transferring everything in the Acquia Drupal folder, but its taking AGES!

learnbythedrop's picture

Re: Moving A Localhost Site To The Web

Yes you upload everything from within the Acquia Drupal folder. If you have a lot of media (photos, audio, video) saved on your site it may take a long time depending on the speed of your internet connection.

kristinerken's picture

Re: Moving A Localhost Site To The Web

Hi, thanks for a great tutorial. I have exported my database (after clearing all cache tables, watchdog and sessions too). Then copied over all files and folder to remote server, including .htaccess. Imported my database to remote phpMyadmin. Changed the username:password@localhost/databasename in settings.php to reflect remote sql username, password, dbname. I keep getting the message that the site is offline due to technical problems. I can't access the login panel using www.example.com/?q=user either. I just get the same offline page displayed. I have trawled through many threads and searched for answers on the web but cannot seem to find out what the problem could be.

Before I moved the site I did put my site into offline mode and disabled clean urls (as suggested by a drupal thread about the best way to move a drupal site to remote server). The second time round (as I have started from scratch 3 times now) I enabled clean urls but still put local site into offline mode before copying files over.I'm at my wits end now. Any help would be massively appreciated. thanks in advance

learnbythedrop's picture

Re: Moving A Localhost Site To The Web

The two things I would try are to either 1) navigate to /user/login and even though the site is offline you should get a login page. Seems like for some reason that's not working for you so option 2) is to navigate to your database on the web using phpmyadmin and set the flag for the offline status manually. If you look for the table named "variable" there is a variable called site_offline that will probably be set to 1. Set it back to 0 and then try to access your site.

kristinerken's picture

Re: Moving A Localhost Site To The Web

Hi, a million thanks for such a speedy reply. I went to mySql databases on cpanel of remote server and discovered - duh! that I hadn't linked the user to the database I had set-up. Oh dear. Couldn't see the wood for the trees or is it the other way round?! Thanks again for your super quick response. Incidentally, I did do an sql query to look for the variable 'site-offline' previously so thanks for that tip. All is working fine now and I'm a very happy geek. your tutorials are very helpful indeed. :))))

ranaali's picture

Re: Moving A Localhost Site To The Web

Hi,
These videos are very helpful. I'm a beginner with Drupal, and I'm still working with my first site on the local host. I have one problem which is I do not get the user log-in box in my site. But I can work with my site as an admin without logging in. But one time, the site didn't recognize me as an admin, so I had to redo form the beginning.
Thank you.

terk's picture

Re: Moving A Localhost Site To The Web

hi i like your videos but im having a problem..

my site is up on a live site but the problem is every link i click is showing page can not be displayed.. i look at the url and its showing local/host/etc

i am able to go to menu and change to mysite/etc and it works all the image and contect is there..

but i have to go thru all the menu and change it.. and i got like over 100 menus lol -_-
is there away you know that i can change it so i dont have to change all the menu...

im thinking it has to do with the htaccess but no clue how to go about thank you very much

learnbythedrop's picture

Re: Moving A Localhost Site To The Web

It sounds like the links to the page were created as absolute links on the local side. How did you create those links? It could be the .htaccess file. Try uploading the original file that came in the zip file with the Drupal install.

NotNotCow's picture

Re: Moving A Localhost Site To The Web

Hey there,

Not sure if this thread is still active, but, it's probably the best I've found in exaplaining the movement for a newbie. So enough butt kissing, here's my problem...I'm using Drupal 7 and my settings file seems to be a bit different to yours, I can see nowhere that I can change the url_db settings..which i think may be causing the following error:

PDOException: SQLSTATE[42000] [1044] Access denied for user 'zionbris_master'@'localhost' to database 'zionbris_zion' in lock_may_be_available() (line 165 of /home/zionbris/public_html/includes/lock.inc).

I'm pretty sure it's a database thing, but I can't spot it for the life of me!

Can you help?

Cheers

NNC

NotNotCow's picture

Re: Moving A Localhost Site To The Web

Actually, ignore me! The answer was pretty simple in the end, I just needed to completley delete the database (again) and re-set the settings.php file:)

Clearly I'm an idiot!

Ta

NNC

jhanjon's picture

Re: Moving A Localhost Site To The Web

Hi, I'm trying to do the reverse, having started a site remotely and wanting a site locally to work on it. I've done this before, but not in version 7. I get the install screen as though there is no site present and I've checked the settings.php, tried various options on the MySQL export and import. Is there something I am missing? Why am I getting an install as though it's a fresh site? My admin is not accepted obviously because it assumes a new site.

Joe

jhanjon's picture

Re: Moving A Localhost Site To The Web

Well, this should be a lesson for me and for all. After setting a local vhost on XAMPP/MAMPP "REMEMBER" to restart Apache. Yup, it was that simple, or, idiotic, depending on your point of view.

In the rush it's sometimes easy to forget the basest of basics.

Joe

learnbythedrop's picture

Re: Moving A Localhost Site To The Web

I'm glad you got that worked out Joe. Sometimes the simplest things are the issues that cause the most headaches.