A Web Design Community curated by Chris Coyier

#87: Moving Up with MAMP

By: Chris Coyier on: 6/17/2010 with 39 Comments

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:

Running Time: 23:30

Direct Download: High Quality, Quicktime .M4V Format (AppleTV Ready)

39 Responses

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

    • Gringer says:

      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

    • Gringer says:

      Oh, and I hate that I now have to re-buffer to where I was :-P

      *hint*Ajax submitting*cough*

  2. Kevin Burton says:

    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.

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

    • rick gregory says:

      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.

  4. Adam S says:

    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

  5. Jim says:

    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/

  6. Michael says:

    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.

  7. Matt says:

    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.

  8. Ray Tiley says:

    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

  9. 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? :)

  10. Bert de Vries says:

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

  11. geompak says:

    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.

  12. brandon says:

    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?

    • brandon says:

      medita temple issue i just resolved… if you connect sftp there isn’t a problem with slowness of the disk feature

  13. Nicolas says:

    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.

    • Natalie says:

      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?

      • Nicolas says:

        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.

      • Mark says:

        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.

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

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

  16. I may convert from FileZilla to Transmit – mounting remote directories and drives is extremely useful!

  17. Nicolas says:

    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.

  18. joelk says:

    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/

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

  20. Johnny says:

    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

    • Nick says:

      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.

  21. 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) ?

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

  23. Henry says:

    Well that really helped me a lot with my work. Thanks a million!

This comment thread is closed. If you have important information to share, you can always contact me.

* This website may or may not contain any actual CSS or Tricks.