Developing a WordPress site locally, on more than one computer

Let’s say you want to develop a WordPress site on your computer ( i.e., locally), but want to be able to work on that same site from a different computer. For instance, you are working on a site at work, but you have another computer at home, and want to easily work on the site from there.

To work on a site from two (or more) computers, you could constantly copy files back and forth, but the site content and configuration will not be the same. But you also don’t want to work straight off a hosted server, as the lag of FTP’ing changes would be slow you down.

Using the method I’m about to describe, you will be able to:

  • Make changes to your theme files
  • Add plugins
  • Create/modify content
  • Change site settings

And it will also seamlessly transfer from one computer to another.

I do not recommend this process for a group environment, as I explain later.

Some assumptions I’m going to make up front:

  • You’ve installed a WordPress site before, by hand, and are comfortable with the process (it’s easy!)
  • You’re using a Mac. I work on a Mac, as does most of my audience, but the same process should be possible on Windows.
  • You have a web hosting account already. If you are going down the rabbit hole I’m about to show you, I’m assuming you’re the kind of person who does.
  • You at least know what a mySQL database is, and that WordPress runs on it, and you can at least get your web host account to create a new database.

Let’s get started

To achieve this, you will need a tasty cocktail of (mostly free) technologies that makes this easy. You need four things:

WordPress

Grab yourself a fresh copy of the latest copy of WordPress. Download it onto your hard drive, and keep an eye on it. That WordPress is shifty.

Dropbox

This won’t be a full introduction to Dropbox – the short version is that it’s a way to keep files synced between computers and devices. Once you have an account, download the desktop app. This will install a directory on your computer that you can place files in that will sync with Dropbox.

Once you are set up, drag your WordPress directory into your Dropbox directory. It may take a few minutes for the whole WordPress folder to sync with Dropbox, but can continue to the next step anyway.

Put your WordPress folder right in Dropbox

MAMP (or WAMP for Windows)

MAMP is an indispensable utility that allows you to easily run a server environment on your computer. It lets you set up things like mySQL and PHP without having to deal with the command line.

This won’t be a tutorial on MAMP (check out one here), but once you have it up and running, you are ready to run WordPress.

Here is the magic part: you can run a WordPress instance from within a Dropbox folder.

All you need to do is to point your MAMP Apache preferences to your WordPress folder within Dropbox.

In the main MAMP window, click “Preferences”, select the “Apache” tab, and under “Document Root”, hit “Select…”. In the dialog box, select your WordPress folder from within Dropbox, and hit “okay”. MAMP may prompt you for an administrator password.

MAMP Start Screen - Click on "Preferences"

Point MAMP's Apache Preferences to your WordPress folder within Dropbox

A Hosted Database

The last ingredient is an empty mySQL database available to you that is hosted somewhere on the internet. Most web hosts allow you to add new databases, and should have a database front end like phpMyAdmin. Once you create a database, you will need to have four pieces of information:

  • The name of the database
  • A user name that has privileges for that database
  • That user’s password
  • The host name for the database – either a website’s URL or an IP address

In you WordPress directory, you will need to adjust the wp-config-sample.php file and adjust it with the above information, and save it as “wp-config.php”.

Setting up your site

Now you’re ready to start working on your WordPress site. You will need to launch it first, so open your browser and go to:

http://localhost:8888

That URL basically points to your own machine (localhost), while using MAMP’s port, 8888. You should see the WordPress set up screen.

If you do, great! You’re ready to rock. On the WordPress set up screen, you will need to enter the database information that you have from your web host. Put that in, plus the normal WordPress info, and you’re good to go.

IF YOU DOn’t SEE THE SETUP SCREEN: You probably are getting an error page saying “Error establishing database connection‘. If you are, there are several things that could be at play. One, your web host’s database may not be accessible from a remote location (in this case, your computer), so that port may not be exposed. It varies from host to host – you will need to check with them. The other issue could be your local firewall settings – if they are under your control, you may need to tweak which ports are exposed.

Bringing it all together

So now you have WordPress up and running on your computer. Sweet! Now, what to do about your other computer?

On your second machine, you will need to install:

When you have Dropbox installed, and are synced with your account, you will see the Dropbox folder has all the files that you put in it on your first computer. That includes the WordPress directory.

When you have MAMP up and running on the second computer, point its Apache preferences to your WordPress folder within Dropbox, just like you did on your first machine.

Now, you will literally have the same site when you go to

http://localhost:8888

on your second computer. Now you can make updates to your theme(s), add plugins, create content, etc., and everything will stay in sync when you switch between computers!

Why this isn’t meant for groups/teams

I would recommend this method only if you are working alone on a site. This idea could theoretically work for two or more people working at the same time on a site. However, I would not recommend this method for a group environment. This is because there is no proper (group) version control with this method.

If you are working by yourself, your changes from one machine to the other won’t happen at the same time. When you are working on a site with other people, nothing prevents them from changing a file that you’re working on at the same time. This can lead to nasty conflicts, and possibly loss of data.

If you are working with other people, you will want to invest the time in getting something like a Git repository set up.

One nice thing, though, if you are going it alone, is that Dropbox will save versions of your files, and you can access them through their web interface. It works all in the background, on every save.

A word about Drupal

I don’t see any reason why this idea wouldn’t work with Drupal. This method is actually CMS-agnostic. As the whole trick is a CMS in a Dropbox account that simply points to a remote database, it should theoretically work for any PHP/mySQL based CMS. I just haven’t had time to try it out.

Wrap up

I hope this tutorial helps you create a better workflow for working on a WordPress site from multiple locations. I would love to hear how this helps people – so please, leave a comment!

  • Awesome idea, Chip. almost what I’m looking for. Only question is, is there a way to make this fallback to an offline DB if the online one is not available? Or would I just have to have two wp-configs and switch if needed? Altho, I’d want some way to keep the online DB synced to my offline one… :/

    Any ideas greatly appreciated

    • Chip Cullen

      Chris – I don’t think there is a way to get a WordPress config to point to a local DB as a ‘fallback’. I’m not sure if WP config lets there be any kind of fallback at all- my understanding is that it points to one, and only one, database. So a limitation of this idea is that you need to be online in order to develop your site. Sorry!

      An unstated goal of this idea was to make working on a WP site easier between computers in sheer terms of the database. (In my opinion) the way WordPress handles databases is a bit crude – far too many things are set to absolute paths instead of relative ones.

      • Thanks, Chip.

        I wonder if I setup my laptop as the db server for my desktop… and then when i took my laptop away, i could still have the same db… :/ Tomorrow’s project!

        (There’s a few things WP could do better!)

  • Thanks for a great write-up, Chip. Just a quick question: Wouldn’t it be possible to install MAMP itself in a Dropbox folder as well? That would ā€“ at least theoretically ā€“ remove the need for a remote MySQL database, because you could then use the MySQL shipped with MAMP. Or am I missing something?

    • Chip Cullen

      You could, in theory, install MAMP inside your Dropbox install – that’s true. I hadn’t thought about that.

      One thing I’m not clear on, however, is if you have MAMP running – where does the database itself live? Does the database move with your MAMP folder, or is it tied to your system in some way? If it is tied to your MAMP folder, then that would certainly solve the portability issue of the database.

      That is a great idea, Alexandra – I will need to experiment with that!

      • Chip Cullen

        I should have taken the time to, you know, LOOK, before posting. Yeah, it looks like your databases are within the MAMP folder itself – conveniently in the “db” directory.

        It looks like, though, to get mySQL to work across computers, it takes a little more finagling. Here is a very exhaustive tutorial on doing something like this.

        • That certainly looks interesting, Chip. I think I’ll have a go at moving the database to Dropbox and then trying that symlink magic …

  • Ross

    Hi I have installed wp on my mac at home and have created a website locally using mamp. I have followed all of your instructions but the website is still not accessible from my work computer.

    I was wondering if the problem is because I have already created a site and so transferring it to dropbox is no longer an option?

    Any help will be greatly appreciated.

    Thanks

    • Chip Cullen

      Ross –

      I’d need a little more information to figure out exactly what is going wrong. Is your WP install in Dropbox right now? When you try to load the site on your work computer – what happens? Are you getting a database error?

      Without knowing more, my guess is that your database is the issue. Moving the WP files around, even after first installation, shouldn’t really matter.

      The trick of this is that there is one, remote, database. That is one provided by a web host of some kind. Is that where your database is set up?

  • i have my blog hosted on wordpress, i wish to host it on the dropbox ..is it possible? Where would be creating database and is there anyway to have cpanel on dropbox?

    • Chip Cullen

      Syed – no, I don’t think you could host a public facing WordPress site on Dropbox. There is no database capability, and I don’t know how you would get a human-readable domain to point there. There are CMSs out there that are built to work on top of Dropbox, but they aren’t WordPress. Check out “Droppages” for an example. The method outlined in this post is purely meant to aid in the development of a site.

  • Sarah

    Hey! Awesome and simple instructions above, thanks! My only question is that I have already set up my local site on my laptop and have started creating the site. If I move everything onto dropbox from MAMP’s htdocs, to dropbox, will this stuff up/break my already designed site? Thanks!

    • Chip Cullen

      Sarah – the only thing I could say would be to try it out. I don’t know how much development you’ve already done. WordPress has an annoying habit of hard-coding URLs, and that may or may not survive a move like this. As long as your database is remote, the location of your files should be irrelevant. I would suggest backing up your database, copying your wordpress directory over, and give it whirl. Good luck!

    • Will

      Use duplicator to migrate seamlessly!

  • JayJay

    Thanks for sharing ! This will help me out a lot !

    What set up should I use to work on a SINGLE wordpress site/installation with a GROUP 3-4 people at the same time ? Thank you šŸ™‚

    • Chip Cullen

      As soon as you have more than one person involved, you need version control. I would set up a git repository (possibly on GitHub) and have people push/pull code from there. The remote database trick may still work – you’d have to give it a shot!

  • 3Cojones

    Thanks for the help — even though this article was update in 2014, I was able to connect MAMP through Dropbox, today almost on 2016. However, I can’t see all the WordPress files on the second computer. Any reason why..???

    • Chip Cullen

      Sorry for taking forever to reply. My guess is that it takes a while for Dropbox to sync all of the wordrpess files. There are a quite a lot of individual files in a given wordpress install.

  • Marcos Di Paolo

    thatnks a lot man, it worked like a charm