How might I setup a development server (local) and a test/production server (remote)

I am thinking, how might I setup a development server locally then when done, upload and sync files + data to test/production server? I think options like siteurl and home in wp_options database table will need to be changed, also, in wp-config.php some settings like database connection and debug mode will be different too.

Related posts

Leave a Reply

1 comment

  1. It’s quite difficult to keep data from a dev version in sync with data on the production site. But for an initial deployment, you are correct that it requires changes to wp-config.php and the database.

    • Install WordPress on your dev machine, e.g. dev.example.com/blog/
    • Install WordPress on your production machine, preferably with the same folder structure as the dev box, e.g. http://www.example.com/wordpress/
    • note: your wp-config.php settings will be different on production. That’s fine, just maintain a safe copy of the file and do not overwrite.
    • Sync the /wp-content/ directory from dev to production (themes, plugins, etc)
    • Using PHPMyAdmin or similar, export the contents of your dev database to a text file
    • In the text file, replace any instances of the dev url with the production url (dev.example.com/wordpress/ => http://www.example.com/wordpress/). This will change the siteurl as well as any links to images in the posts
    • Using PHPMyAdmin or similar, import the contents of your dev database to the production database
    • Try accessing the WordPress admin module in the production server – you should be good to go.

    This technique works for me, but I’d love to hear of any cleaner migration techniques.

    UPDATE: There are a number of techniques discussed in the following post, including a plugin that handles the db grunt work:
    How to: Easily Move a WordPress Install from Development to Production?