Working locally with MAMP is awesome, but what about when you need to take that site live? Last time we got a version of WordPress installed locally, now we’ll take that local version and move it to a real live site. This entails moving files as well as moving the database, and changing a couple of values in that database.
Links from Video:
A few things I didn’t discuss in the video:
Make sure new “live” web server has the same technologies available as you do locally. WordPress runs on even PHP4 and simply needs MySQL. But if you were creating a Rails site, it’s likely more setup would need to be done.
When working locally, at least on a Mac, files that begin with a period are hidden. Like the ever-important .htaccess file. Make sure that gets moved properly when going live.
If you were moving from a live site on one domain to a live site on another domain, there may be more work to do: redirecting the old site, moving DNS (or A & MX records), and potentially closing down the old host after a certain amount of time. This might be a whole tutorial in itself…
Around 01:22 I see a curser blinking at the end of the article paragraph.
Is this a glitch or some nice plugin you didn’t tell us about yet ? (in-page editing of articles ?)
—
Gringer
Oh, and I hate that I now have to re-buffer to where I was :-P
*hint*Ajax submitting*cough*
Just a note: you can have as many websites locally if you know how to adjust apache server and /etc/hosts file.
MAMP PRO is only an interface to do these for you.
Cheers.
Thanks for the update Chris. Just a quick suggestion.
If you are moving WordPress after setting up the site in full locally you will have many records in your database with the old domain in it. I would export the old database and open it in a text editor and use the find and replace functionality to replace all references to the old domain and replace then with the new domain.
Second little suggestion you only need the wp-content folder for each specific site that you are uploading so I would suggest connecting with ssh and using wget to get the latest version of WordPress from their servers and then uploading the wp-content directory via FTP – will save you that 10 minutes it took to upload the whole thing :)
wget http://wordpress.org/latest.tar.gz
tar xzf latest.tar.gz
Cheers,
@Prydie
To add a little caveat to my first suggestion. If you have a large db (and I mean very large) opening the file in a text editor depending on the editor and the amount of free RAM you have can be a little dicey. So use the sed command in bash to replace the old hostname (i.e. localhost) with your domain name :)
sed -i.bak 's/localhost/www.pryde-design,co.uk/g' db.sql
@Prydie
Thanks for sharing, this saved me so much time.
No problem. I have written these and a few more tips up on my blog if you want to check it out :)
http://www.pryde-design.co.uk/2010/06/moving-wordpress-localhost-to-live/
ANother way to do this is to use phpmyadmin to open the database on the new, live server and edit the relevant fields in, usually, wp-options. Home and siteurl are the two basic ones, but the larger issue are uploads and any embedded paths done by plugins. Those are better to do in a text editor.
A great step by step guide for anyone that’s never done this before.
One problem I’ve run into in the past when porting a clients exciting site over to work press, is to make sure you have access to modify the .htaccess file.
I’ve ran into this problem once before when moving a local site to a live server. After double checking everything, and thinking it some sort of weird caching problem, only to fine that the sites permalink settings were unable to write to .htaccess
My go-to resource for migrating WP from local to remote host. Includes the very helpful step of replacing local URLs with domain specific URLs.
http://www.webdesignerwall.com/tutorials/exporting-and-importing-wordpress/
Chris,
Excellent screencast. I like the casual approach as it’s like how I approach a new app also.
I’m just getting going with MAMP Pro and was wondering if I can set up multiple sites locally, but with one being WordPress, Joomla and Drupal?
Should I just set up multiple folders for each projects and do a fresh install of each CMS in each location? For example, I have 2 drupal sites, so make two folders and install drupal in each to keep them separate?
Thanks,
Michael
Yes, if you just set up different folders within the ‘htdocs’ folder for the different CMS’s, and create seperate databases within phpMyAdmin. I’m a Drupal Developer, and have several different versions of Drupal running in MAMP, as well as bespoke PHP projects.
I’ve ran WordPress on Nginx, Lighttpd, and IIS 7, so yes, it can run on other web servers besides Apache. The general rule is that if it can use PHP, it can run WordPress.
Hey Chris,
Have you ever looked into something like capistrano for deployment? http://www.capify.org
It works really well for Rails, but I’ve also started using it for my PHP projects as well.
-ray
Thanks for the mention Chris! Slightly offtopic question: who did the awesome intro for that screencast that you use? Where can I hire him / her? :)
Hey Joost,
This is the guy:
http://kmogvideo.com/about/
Highly recommended!
My procedure looks like this:
1. Zip the PHP files
2. Upload the zip file
3. Unzip the lot
4. Create database and user
5. Export the database to SQL file on desktop
6. Do a scan and replace with notepad
7. Edit user and database info in SQL file
6. Import the SQL file and run.
7. Do a test.
Thats it. Shouldn’t take more than 5 minutes.
Greetings from Holland.
Oh, Chris Congrats….
hey. i love your tutorial chris.
but i must say i like u better when i see you righting code :) anyway. another great tutorial delivered.
I noticed in the screencast that transmit’s awesome new feature – being able to browse your server as if a normal osx window – seemed to hang up. was the server MT? just wondering… since that transmit feature works fine for me on all hosts except for my clients (and myself) who use MT. The behavior I encountered was similar. I asked mediatemple but they didn’t seem to know. Does that feature work with MT for others?
medita temple issue i just resolved… if you connect sftp there isn’t a problem with slowness of the disk feature
Haven’t looked the full screencast yet but one thing I hear you talk about Chris is something I would love to have a plugin for WP. A Plugin that is able to get changes from a local install (as long as you have an internet connection) and apply them to the live site (or the other way around so you always work with the up to date data locally).
It’s not that the process of exporting and importing the database and copying mostly Theme or/and Plugin files is really hard … it’s just a pain. Something like a “mirror” Plugin would be cool for this.
I keep toying with this plugin (Backup Buddy) http://pluginbuddy.com/purchase/backupbuddy/ for just that very reason.
Haven’t used it yet, but have an opportunity to shortly. The migration alone would be worth it, but added in backup capability makes it really something I think. Wonder if anyone else has had experience using it?
Thanks for the mention of the Plugin Natalie. I heard about it but didn’t know it makes migration that easy as they advertise on the their site. Will have to check out the videos some time soon. I don’t mind paying for a Plugin and 45$ for a single license seems pretty reasonable.
Hi Natalie, I’ve bought & used Backup Buddy & been very pleased with the ease of use & the results.
Full site or DB backup creation is fast & the resulting file can be sent via FTP, email or now uploaded to Amazon S3.
For migration, backup the site to be moved, upload that zipped file to the destination along with the Importbuddy php file. Run the 5 step php file adding the new DB settings in the appropriate place & login.
Currently, changes to Username & Password have to be made from with the WP dashboard.
Copying any more than a couple dozen files via FTP is painfully slow. It’s a heck of a lot faster to zip the entire tree, copy the zip, then unzip on the server.
Agreed!
You can use Sequel Pro to import and export the databases without having to log onto different local and live servers and use phpMyAdmin.
If you open the local database in Sequel Pro and select File > Export > MySQL dump, you’ll export your database as a .sql file – the same as if you did it through phpMyAdmin.
Then, switch to your live database and select File > Import, and select your .sql file. Done!
I may convert from FileZilla to Transmit – mounting remote directories and drives is extremely useful!
Up to now I “only” used the free version of MAMP because I didn’t really think I would need the paid version. But after the full screencast I might think about it again. After all, it’s not an expensive app at all for what you get.
I dont watc video !
just for the PC users the version is WAMP (Windows, Apache, mySql, Php)
go to: http://www.wampserver.com/
you must shut iis server in some windows os
Linux users version: LAMP (Linux, Apache, mySql, Php)
go to: http://www.sph.umich.edu/csg/abecasis/lamp/download/
Hi Chris
Thanks for the screencast.
I use Mamp pro for a while and after seing your add one personnal domain localy, I try by myself on 80 port.
Since this time, I can’t connect to this site on line with the same computer I have used for this experiment. It’s weard! If I use an other computer, even on the same wireless network, the connexion to this just work fine.
I try to restore factory setting on Mamp and delet all caches and cookies but nothing works.
Anybody has these experience? Have you some tricks? Thanks!
i just reinstall mamp and everything works fine
Hey Chris,
Did you ever hear what the security concern might be when you “run Apache/MySQL server” as name/name, versus www/mysql in MAMP Pro?
Anyway I just thought I’d share some observations/problems I had yesterday while trying to get MAMP Pro and virtual servers running on my machine.
First, I don’t handle discrepancies well, meaning when two of the same thing are different, it baffles me. But the “official MAMP Pro landing page,” telling you your virtual server is running, and the vague “It Works” page, essentially — as far as I can tell — mean the same thing, it’s running. Go figure.
I’m new to this whole port thing, but had issues using port 80 in my particular configuration. Apache wouldn’t run. But when I left the port blank — I can’t recreate the issue this morning, for some reason — it ran fine. But the local domain I was using had :8888 on the end of it. Short story is if you turn off web sharing (System Preferences>Sharing) Apache runs with the port set as 80, and the :8888 in the address goes away.
Point is, I’m happy.
Hope this helps,
Johnny
Johnny,
Thanks for mentioning this, I had the same issues.
With no port set, my local domains resolved at Mac OS X Web Sharing instead of the disk location I set in MAMP. When I tried to set the port to 80, Apache would not start.
To get my custom local hosts to work in MAMP Pro I had to turn off my Mac’s Web Sharing in the System Prefs and remake the local host with port setting of 80.
Some themes require cache folder to be CHMOD 777 to enable auto thumbnail generation,
how to enable CHMOD 777 on local host (with MAMP or WAMP) ?
Yes, Me2
I want to CHMOD faster then trough the info tab on mac.
Thnx
Thanks for the rundown Chris. I’ve been using MAMP for a while now, and was wondering whether or not MAMP PRO was worth the upgrade. In addition, I recently ran into a situation where I needed to move from a localhost to live and found this quite helpful.
Well that really helped me a lot with my work. Thanks a million!
Hey Chris, You really are a life saver spent ages working local host getting all the pages ready. Then had a heart sinking moment thinking I have to do it all again live :( Great vid 10/10 dude!
Thanks for the awesome post, Chris. A real life-saver. Love the easy-going, fun style. Keep up the good work.
For some reason I can’t use a short name in my browser, like you did with testtesttest. If I try that with my hosts I get permission errors and changing permissions doesn’t help. But if I put in the myfolder:8888/whatever.php, then I can see the pages. What’s the trick?
I have the same problem. Any solutions?
Chris,
I’ve used your podcasts before and gotten a lot out of them. I want to say this in the friendliest sort of way… you really need to organize what you’re doing before you start the screen cast. You’re half-way presenting a dozen things at a time while you’re trying to explain whatever the main thing is. Think about creating an outline for yourself. Most of us need a step-by-step using the simplest process and the most basic tools. If you want to demo new features for MAMP Pro or talk about the latest new software you’re using, that might be better as a separate podcast. I have at this point given up using this podcast to help me do basic wordpress migration from localhost to live hosted. I’m sure the explanation was in there somewhere, but you lost me. Sorry.
I totally accept and appreciate the criticism.
I also gotta say they aren’t going to ever be any different. I like to just wing it and make mistakes and just publish it. And enough people have told me they like it that I’m going to keep it that way. I make zero money off these things, and the the only way I can keep doing them is if I can just do it the way I want and that is easiest for me. It’s probably chicken/egg. If I did them really polished up, maybe I’d get more sponsors or whatever and make money on them, but I’m not interested in that.
Amen, Chris! I follow all your stuff via RSS, iTunes and Apple TV because you, unapologetically, don’t know what’s going on half the time. And thats who most people prefer to learn from, someone that’s learning alongside them. Keep doing things the way you are!
Chris,
Just had the same issues uploading via Transmit. But then also with Coda! I noticed Transmit wasn’t able to see my Applications folder. So I moved htdocs to Sites and set the Document Root to there in MAMP preferences. Now works. Odd.
Hi Chris,
First off, thanks for all the work you put into these screencasts, and CSS-Tricks in general. This site is a tremendous resource.
This is obviously a pretty late comment, but I wonder if you or anyone else out there might care to elaborate a bit on Luke’s initial comment regarding the whole www/mysql thing. When developing WordPress and Drupal sites on MAMP, I run into some permissions problems when I run Apache/MySQL server as user www/mysql (not an uncommon problem, I guess). But when I go to correct the permissions on the folders/files that need it—per Luke’s suggestion—I don’t see any existing “www” or “_www” user. If I try and add a user, I’m given the option of creating a “New Person” with a unique username and password (running Mac OS 10.6.8). Do I really want to create a “www” user, give it a unique password, and then give that user read/write permission? Is there maybe some command line I need to run?
Apologies to anyone and everyone for what is probably a stupid question with a pretty basic answer… And thanks again.
So, just in case anyone else ever runs into this issue, I ended up solving it with the help of BatChmod, which is a pretty awesome little program that lets you change and assign permissions in OSX. Seems especially helpful in Snow Leopard, which doesn’t list the _www and _mysql users when you use the “Get Info” command on a file or folder. I just used BatChmod to give the webserver read/write on all the files and folders that needed it. I know all this can be done via command line as well, but BatChmod seemed just that much easier.
tried using batchmod and changed user and group to www and allowed read and write. Still the folders are not accessible to me. Should I just go back to user/user? that’s a security problem right? Is that ok if I’m not using web sharing in my sharing preferences?
I was struggling with this issue too, until tonight. I found out that if you option-click on the “+” in the bottom of the info-window (CMD+i) for an upload directory for example, you can see the full list of users. Then scroll down to the “World Wide Web Server” user (one person icon, not the group with two person icon) and add this user (_www) to the list and select the proper read/write permissions. You should have proper read/write permissions now, assuming you’re running MAMP as www/mysql.
Thank you, Chris. Really helped!
Wonderful tutorial. I look forward to checking out your other videos.
Also, thanks to everyone who made suggestions, between the different links that was posted and suggestions and your video, I managed to migrate my site successfully with only a few bumps along the way.
So, if i can create any domain locally, why wouldn’t i just do the following: let’s assume i’m working on this site: niek.com, i develop it locally with mamp (pro only i suppose), calling it just that: niek.com, and then i upload it to the live version of niek.com. Surely this way the database has all the correct paths to images etc, and there’s no need for any search and replace…?
Only problem is that you won’t be able to access the live niek.com unless you use a different computer.
Just installed mamp and ran into several problems, some discussed here.
1. Could not view site: Change apache port to default: 80.
2. No php errors display when you have an error; just blank screen. Open up /Applications/MAMP/bin/php/{your PHP version}/conf/php.ini.
Find display_errors = Off. Change it to display_errors = On.
Restart MAMP . Why this is off by default makes no sense to me.
3. Run Apache/mysql as user: web/myslq. This caused site to break because web does not have permission to that folder. If you don’t want to go through the permissions dance (could be dangerous on unix), put your website folders in /applications/mamp/htdocs or /users/your-user-folder/sites. User www has permission to both of those folders.
Update on permissions: If you use web/myslq users, you won’t be able to install WordPress plugin from WordPress admin. You’ll have to download the plugin and install it from the zip file.
Chris:
I love your video cast. I’ve watched several and they are all helpful and fun. I am new to all of this and I feel like I get to hang out with the big boys.
I saw someone suggesting that you dont wing it. It was actually really helpful for me to see you go around to try and solve problems. I would not change a thing.
Thanks for your time and efforts.
Hey Chris,
Very useful to this total newbie, but I have to correct some of your grammar in the final minute or so of the video:
“Would’ve come across,” not “Would’ve came across.”
“Came” is the past tense.
“Come” is the past participle.
Since “Would’ve come” (contracted form of “Would have come”) includes the perfect tense form “have come,” you need to use the past participle (“come”) not the past tense (“came”).
I know that’s not totally clear. Just had to put it out there as your resident grammar Nazi.
MHB
I found some more better then Sequel Pro tool – Valentina Studio, it works as with mySQL. http://www.valentina-db.com/en/valentina-studio-overview
Having read this I thought it was very informative. I appreciate you taking the time and energy to put this content together. I once again find myself spending a significant amount of time both reading and leaving comments. But so what, it was still worthwhile. Thanks for sharing.