Local WordPress Development on Multiple Machines

Working with WordPress on a local machine can be frustrating if you frequently use more than one computer.

I’ve seen a few blog posts where developers will set up two MAMP instances and then sync their database files with Dropbox so they can access the same database file on both machines. This is tricky to set up and can easily lead to corupted database files.

Instead of using the MAMP provided local database, I use a database on my web host account and store all the WordPress files in DropBox. Here are the steps:

Setup

  1. Install MAMP on both machines.
  2. Once MAMP is set up, go to MAMP Preferences -> Apache and change document root to your Dropbox folder or a Dropbox subfolder. For me it’s: /Users/Kevin/Dropbox
  3. Ensure you change this setting on both machines
  4. Now create a database on your hosting account (I currently use Namecheap hosting).
  5. Be sure to enable remote access to MySQL. If you’re using a shared hosting account and cPanel, click on Remote MySQL

WordPress Installation

  1. Download WordPress and unzip it
  2. Place the unzipped WordPress folder in your Dropbox folder
  3. Start MAMP
  4. Go to: http://localhost:8888/ (This may be different if you changed your default MAMP port settings)
  5. Click on the WordPress folder
  6. You should get the following WordPress wpconfig.php setup screen:

    create wp-config.php file

    Create WordPress wp-config.php file

  7. Now create the wpconfig.php file. The tricky part is figuring out the correct credentials for remote login to your hosted server. Here is an example if you’re using BlueHost:
    Remote database settings

    Remote database settings

  8. If you’re using a shared hosting account, you may need to prefix your database name and username with your username. When you create your database and users from your cPanel, you should see something like: username_databasename. For example: kcm_wp1
    Your username would then be something like: kcm_user1
    And you may need to use an IP address in the Database Host field.

The only downside to this arrangement is that it’s not quite as fast as a local database.

If this post seems like gibberish and you just want to figure out how to run WordPress on your computer, check out this post: . If that doesn’t make any sense, leave a comment and let me know how I can help you.

It’s really good practice to install multiple instances of WordPress on your local machine using different scenarios. It makes the real life installation second nature.

15 thoughts on “Local WordPress Development on Multiple Machines

  1. Joel Stransky

    I’m trying to do this using xampp and mediatemple’s gridserver.
    I’ve white listed my IP, created the database and given my user privileged to access it. When using the correct url mediatemple prefers you to use when accessing an external database I get the first page of the install screen to appear. After I fill out the site name, admin log and pass and click install, it spins for a bit then only loads a portion of the success page (basically just the wp logo). I can then login but only see Dashboard and Profile in the menu. Something is failing but I have no idea what. Any ideas?

    Reply
    1. Kevin Marsden Post author

      Hi Joel, I haven’t tried this with Media Temple, but I’m assuming it’s because of the way their servers are set up. I’m pretty sure they have a different setup than the standard shared hosting setup. Sorry I don’t have more details to help.

      Reply
      1. Joel Stransky

        Thanks Kevin,
        I seem to get normal access to the admin after the failed table creation so I’m thinking I might just be able to do the install all on the server and then move my project to my local machine. I’ll reply after I’ve tried it.

        Reply
  2. Enzo

    Great tutorial Kevin! Worked a charm…
    What would I do once I’m ready to move the site online? (to the same hosting where I created the database)?
    Cheers,
    Enzo

    Reply
    1. Kevin Post author

      The issues are similar to most local to production migrations. You’ll definitely need to search and replace any mention of your local URL in the database (mine is : http://localhost:8888/SITE_NAME). Then you’ll need to FTP everything in your local wp_content folder up to your production server. I don’t do this very often, so I may be missing a step 🙂

      Reply
  3. Darren

    Great post and excellent tip, I’ve been trying to figure this out for a while as I have 3 different machines I develop on….

    How do you get around the local ip address issue where image and URL paths stored in the db are pointing to the originating IP address?

    For example, I set up a site at the office, where my ip address is 192.168.x.x:8888, but then my home machine is 204.168.x.x:8888 – On my home machine I would get 404s as the ip address is not available.

    I can access the DB, but all links and images would be pointing to the other IP.

    Does that make sense?

    Reply
      1. Darren

        Ahh right! I should be using localhost:8888…
        I forgot about this as had been using my local IP address at the office to enable co-workers on the network to view my machine at 192.168.x.x:8888.

        Thanks again for the tip!

        Reply
  4. Ashley

    This has been so helpful Kevin.

    I’ve gotten it to work just fine on two separate PC’s.

    But I can’t get it to work on my Macbook.

    The problem seems to be that all of the WordPress files don’t have the correct read/write permissions. I’m using Google Drive instead of Dropbox, not sure if this is the source of the problem?

    Do you have any light to shed? Thanks.

    Reply
    1. Kevin Post author

      That’s a really good question. I don’t use Google Drive much, so I’m not sure what the problem might be. If you figure it out, please let me know. Cheers!

      Reply
      1. Ashley

        I just tried it on Dropbox and got the same problem.

        In my browser, at locahost, I’m getting this error message: “Access forbidden! You don’t have permission to access the requested directory. There is either no index document or the directory is read-protected.”

        When I check the permissions on the directory, it says that I (as a User) have read-write permissions, but that “everyone” has read-only. I changed “everybody’s” permissions to read-write, but that had no effect.

        Stumped…. 🙂

        Reply
        1. Kevin Post author

          Hmm. That’s strange, because most issues resolve around remote database access.

          My new shared host doesn’t allow remote MySQL connections, so I haven’t tested this method lately.

          I’m sorry that I’m not more help. Let me know if you’re able to figure it out.

          Reply

Leave a Reply

Your email address will not be published. Required fields are marked *