Media Temple: Moving WordPress and MediaWiki From (Gs) to (Dv)
I’ve reached the point where I’ve outgrown the Media Temple (referral link) (gs) gridservice offering and have migrated to a (dv) dedicated virtual plan. My primary reasons were increased scalability, performance and flexibility. I’ve read some negative comments about Media Temple, but I’ve been with them for 3 years and had no problems, other than the occasional slowness. Their customer service has always been responsive and helpful.
I have a number of sites hosted on the (gs), including WordPress and MediaWiki sites with MySQL databases, some of them are mine and some below to third parties.
(dv) comes with a Plesk front-end management tool, which is ok, but the first thing I did was enable ssh access as I prefer the extra flexibility that hands-on environment gives you. Though I did spend the afternoon familiarizing myself with the Plesk environment and I like it well enough.
There are a few caveats when moving WordPress to a new site. I also changed the domains, and that added some extra complexity. I moved:
- http://exerro.com/
- http://blog.http://nickt.com/ to http://nickt.com/
- http://blog.nickt.com/ to http://nickt.com/
- and some other, minor, changes
I got rid of the leading hostnames mainly to simplify my environment and it also aids SEO.
These are some of the things you should watch for:
- The backup and restore of the database didn’t work well and I didn’t have much confidence in it. (mt) have a KnowledgeBase article on the subject. I used the command line to backup the databases like this:
$ mysqldump --add-drop-table -u Username -p dbname > dbname.sql
- And restored them like this:
$ mysql -u Username -p dbname < dbname.sql
- As I’ve moved domains, the databases needed some work to fix links. I found an article that was of help, but what you basically do is
- update the wp_options table with:
UPDATE wp_options SET option_value = replace(option_value, 'http://OLDURL', 'http://NEWURL') WHERE option_name = 'home' OR option_name = 'siteurl';
- update the references to absolute URLs:
UPDATE wp_posts SET guid = replace(guid, 'http://OLDURL','http://NEWURL');
- update the posts that reference other posts on the site:
UPDATE wp_posts SET post_content = replace(post_content, 'http://OLDURL', 'http://NEWURL');
- update the wp_options table with:
- As I changed domain names, the permalinks broke. Make the .htaccess file writeable and in wp-admin/settings/permalinks hit “save changes” to regenerate the permalinks. If you have a problem here, it’ll probably be down to the .htaccess file either not existing or not being writable.
- WordPress on (dv) requires the permissions on the wp-content/uploads directory to be 777, or you have problems adding to your media library. There may be a better way of doing this, but after spending a couple of hours I decided it was good enough. You also have to either edit the wp_options table in the database or simply change the settings/misc uploads setting in WordPress admin to be “wp-content/uploads” (note there’s no leading “/”). There are a lot of threads on the (mt) forums discussing this, this is the most relevant one. The WordPress forums also discuss this problem.
- Also to allow successful uploads to your media library, PHP safe-mode has to be “off” as the httpd server and filesystem permissions are different. The easiest way to change this setting is via the Plesk control panel, but you can also edit
/etc/php.ini
. - I had some non-WordPress files, mostly images, on the old sites, so I used .htaccess to redirect to the new locations, specifically for links to files and images I’ve been posting to forums for years, and didn’t want them to break. For example, http://nickt.com/landrovers redirects to http://exerro.com/oldsites/2009/http://nickt.com/landrovers/.
- I use the WordPress Database Backup plugin, and it needed a new backup directory to be created in
wp-content
and made writable. - I noticed that the WordPress Automatic Upgrade and the automatic plugin upgrades now require an ftp username and password.
- I setup MediaWiki to use short URLs, like Wikipedia, (aka removing “index.php” from the URL) in line with best practices for forming URLs using this method.
- Also for the codex exerro”, I only allowed authorized users to read pages using this method.
- I temporarily disabled account creation by adding ”
$wgGroupPermissions['*']['createaccount'] = false;
” toLocalSettings.php
I’m still wondering whether or not to use Drupal instead of MediaWiki for both the “codex exerro” and a private wiki I’m building. Drupal has more flexibility in terms of user rights management (or is at least simpler than MediaWiki) and managing content (unsurprisingly as it is a Content Management System), but doesn’t look as good out of the box and is more complex to setup and maintain.
Anyway, it took around a day to migrate half a dozen sites and databases. I’m looking forward to pushing (dv) to see what it’s got!