#87: Moving Up with MAMP

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.

Comments

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…

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 :)

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 :)

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.

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

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?

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

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.

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.

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!

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.

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.

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?

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

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.

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.

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…?

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.

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.

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.

Submit a Comment

Posting Code

You may write comments in Markdown. This makes code easy to post, as you can write inline code like `<div>this</div>` or multiline blocks of code in triple backtick fences (```) with double new lines before and after.

Code of Conduct

Absolutely anyone is welcome to submit a comment here. But not all comments will be posted. Think of it like writing a letter to the editor. All submitted comments will be read, but not all published. Published comments will be on-topic, helpful, and further the discussion or debate.

Want to tell us something privately?

Feel free to use our contact form. That's a great place to let us know about typos or anything off-topic.