Mirroring a WordPress *configuration* between local and remote

Ok, so I’m familiar with creating local WordPress builds, and have been chugging along happily with the technique outlined in Smashing’s MAMP-based article. My question goes a step beyond this.

The article is great for developing generic themes, but when developing sites (not necessarily blogs) based in WordPress, for me at least, it’s a little painful come launch day.

Read More

I have to go back in and reconfigure the server’s WordPress to match what I’ve already done locally. Settings have to be entered again, plugins need be installed again, menus recreated, and css will have to be altered to reference the unique classes/id’s WordPress generates for posts/pages/custom taxonomies…sometimes things are missed in the process. What I want to know is this:

Is there an easy way to automate cloning or mirroring the build on my local machine to the remote server?

Even if you have to just LMGTFY me, that would help. I don’t exactly know what I should be searching for. Searches dealing with ‘mirroring wordpress configuration’ and ‘cloning wordpress configuration’ returns tutorials on moving content, which I know how to do.

If it helps, I’m running OSX 10.6.8 with xcode dev tools, git, ruby, node, and homebrew. All of my live servers have ssh access as well as ftp, and I build with the most current versions of WordPress.

Related posts

Leave a Reply

3 comments

  1. Here are some easy steps to follow:

    1. Download and install the WP Migrate DB plugin.
    2. Go to Tools > WP Migrate DB and fill-in the blank fields(New address (URL), New file path and optionally check/uncheck the other options). Click on Export Database and save the export file to your computer.
    3. Make a .zip archive with ALL of your files(the /wp-admin, /wp-content, /wp-includes directories and all files in the root directory).
    4. Upload that file to your production server, where you want your WordPress site to reside.
    5. Go to your cPanel(or use the unzip command through SSH) File Manager(or any other alternative that you might have) and unzip the file that you just uploaded.
    6. If you don’t already have a Database set-up on your production server – create one through the hosting control panel(for cPanel, it would be Creating a mySQL database in cPanel, for plesk it would be Plesk 7 Tutorial: Creating a database, for anything else, just google it up, or try your hosting’s FAQ). Remember/write-down your Database Name, Database User and Password.
    7. Edit the wp-config.php file and change the values for the DB_NAME, DB_USER, DB_PASSWORD and optionally DB_HOST – but this is usually localhost – if that doesn’t work try asking your web host, or if you have phpMyAdmin, log-in to it and look at the very top of the page – in this case the DB_HOST would be localhost.
    8. After you’ve done all of that, log-in to your DB administration tool(most of the time this would be phpMyAdmin, but it could be something else as well) and upload the database export file that you save to your computer in step 2. Note: If your hosting hasn’t provided you with a DB administration tool, I would suggest that you upload the phpMiniAdmin(click on the “Download latest version” link and save the file to your computer) script to your production server. Then go to that script(if your website is located at http://example.com/, go to http://example.com/phpminiadmin.php) and enter your DB details. On top of that page, you will see an import link. Click on it and upload your DB export file. Note 2: phpMiniAdmin doesn’t support gzip-compressed files, so if you did check the Compress file with gzip option in step 2, you will have to re-do that step with this option unchecked.
    9. Log-in to your site and go to Settings > Permalinks in order to update your permalink structure.
    10. Check the permissions of the /wp-content/uploads and /wp-content/plugins directories – make sure that you will be able to upload images and plugins without any problems.

    That’s pretty much it. It might seem like a lot, but I follow this process for almost every site that I upload to production servers and it can take me as less as a bit under 10 minutes to do all of that(considering that I usually use custom MySQL commands, instead of the WP Migrate DB plugin – I should probably start using it 🙂 ). Once you get used to the process and you don’t encounter any low-quality web hostings, you should be perfectly fine with these steps.


    Note: Since you used ssh as one of your tags, I assume that you usually have ssh access to the production server. If you don’t I’m still assuming that you have a cPanel access(if that’s not true and you can’t unzip files on the server, then upload all files manually via FTP client, instead of doing steps 3 and 4).

  2. I guess the only way is to copy the database or part of it.

    What I do is to copy the relevant tables and modify manually the site URLs in table options. There are only 2. There is also a nice plugin velvet-blues-update-urls to modify all links, after the site URLs are set manually to be able to access the backend, in case posts are also copied.

    Next, copy all theme directory files to the same directory in the site, assuming you are using the same theme.

    Both processes can be automated with a PHP script.

    I am not sure this is what you want, but hope this helps.

  3. Not sure that this is exactly what you need, but to move a site you can use the built in WordPress “export” and “import” options. As far as I remember there was an option when importing to change URL’s and the import would change a few things for you.

    Even if this does not answer your exact question, hope it helps.