Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress Local WordPress Development Local WordPress Development Migrating WordPress from Local to Live Server

Nthulane Makgato
PLUS
Nthulane Makgato
Courses Plus Student 19,602 Points

How do I upload files to server once server is set up?

A bit of a weird question but hey...

So i managed to migrate my local development to live development, I understand how to import and export databases to and from local/live environment but i want to know how I upload local files to the live server, do i just drag and drop all the WP files into the "public_html" file or upload specific files?

Thanks!

6 Answers

Chris Shaw
Chris Shaw
26,676 Points

Hi Nthulane,

Normally you upload all the WordPress files as there is nothing that typically needs to be left behind on your local environment aside from the wp-config.php file which you will need to change to point to your live database instead, aside from that you should be good to go once everything is uploaded.

Cynthia (Sunni) Freyer
Cynthia (Sunni) Freyer
828 Points

Interesting Chris. I always maintain my local dev sites for future work, rather than ever developing on a live site. I use ServerPress for WP sites, which makes it oh so sweet. The SP does all the work...from local server install to turning on/off local server, to enabling upload to production without having to fuss with path names. I just wish the developer would fork it to Drupal. Of course, I get your advice if it's just a little brochureware site...

Nthulane Makgato
PLUS
Nthulane Makgato
Courses Plus Student 19,602 Points

Thanks for your feedback Christ and Cynthia. I understand what you mean, i just worry about certain aspects that I don't understand.

My website interacts with users and sometimes they store information in the site and access it through WP users account. When i make changes locally to the site and database(indirectly as i work on the site), and upload it via FTP, won't their information be erased or altered? I worry about this because when i upload the files via FTP, I am asked whether i should overwrite files or not.

I also wonder about importing a database that i was working on locally to the live server that may have interacted with users. I worry that I may be overwritting databases with my local one.

I hope you understand, your thoughts would be greatly appreciated.

Chris Shaw
Chris Shaw
26,676 Points

Uploading the WordPress file base doesn't modify your database which is where your users get stored, you won't loose any data by overwriting your old files with news one so there's nothing to worry about there.

Cynthia (Sunni) Freyer
Cynthia (Sunni) Freyer
828 Points

That's a great question -- dev to live when there are active users posting. It's discussed here: http://www.carriedils.com/deploying-wordpress/

I usually have a ten-minute window where I could lose active user's posts. I use a testing site and a dev site. Bring in the db, work locally, then bring in most recent database, be sure all is good to go, and then upload. Ten minutes downtime at the least. But do read the link I provided. It's far more detailed.

It's not always perfect though.

Chris Shaw
Chris Shaw
26,676 Points

Hi Cynthia,

That is actually a backwards and incorrect as you should never be pulling down a live database, making changes and uploading it again as this technique can do more harm than good. A much better way to make updates to your database is taking a copy of it, restoring it locally and applying changes using an SQL script(s), if the script(s) works then you run them on production given you take a backup just prior to making the updates.

Of course messing around with databases may sound like fun but there's an even better way of managing databases and that's by using a tool I love called dbv or Database Version Control.

Cynthia (Sunni) Freyer
Cynthia (Sunni) Freyer
828 Points

If you reread my post, you will see I'm speaking about ServerPress, which has a direct deploy method built in. Perhaps you should have read more about serverpress or the link before snarling away in a post.

Nthulane Makgato
PLUS
Nthulane Makgato
Courses Plus Student 19,602 Points

I meant "Chris" not "Christ", sorry about that.

So i added files to live server via FTP, then went back to local development, developed some more, downloaded plugins, made changes etc and then i was uploading files via ftp and overwrote the older ones but when i went to the site on the browser, it wasn't connecting to database. I had to go to the config.php file and change it again... basically went through the same initial process and there werent any of the development changes that i had made in the interim on the live site.

What am i doing wrong?