When server moves go feral

Server moves, they're never ever really fun, but sometimes they're a necessity, and by the following the right sequence of steps, they are usually straightfoward: download files from current location and upload to new location; export any databases, and then import them on the new server, change config files to point to the new databases, and you should be all good.

But sometimes things don't quite go as planned and what works fine on the old server ends up broken on the new server. The first thought is usually that there's something different in the configuration of the two servers that is causing the problem. And that's what happened to me this week. I had to move a site which just had plain ol’ HTML in the root directory but a ShopperPress store in a subdomain. Transferring the static HTML files and previewing at http://ipaddress/~account-name/ was fine, but when trying to view the Wordpress installation at http://ipaddress/~account-name/store/ I got a white page with a bunch of random code being printed out and viewing the source of the page looked like this:


/* ============================= PREMIUM PRESS GLOBALS ========================= */

$GLOBALS['???']['price_tag'] 			=??ion(??_pricetag");
$GLOBAL???ess'???rice?ra'] = get_optio???rice?ra");
$GLOBALS['???']['StockControl']		= ge?tion("display_ignoreQTY");

$GLOBALS??mpress']['showpages'] 			= get_option("displ???");
$GLOBALS??mpress']['checko?rl'] 		=??ion("che??l");

if($GLOBALS['prem??']['?lay_themecol?'] =="3" ){
$GLOBALS['ga?yblo?op'] = 2; //<-- ??ermi?hen the margin i?opped within the? ite?else{
$GLOBALS['galleryblock?'] = 3;

$GLOBALS['display_sidebar_ba?'] 		= get_option("displ?idebar_basket");

Pretty ugly and weird, huh? :? So after trying a few different things including checking permissions, uploading the files again, I thought it must be a server issue because it's working fine in it's current location. So I contacted server support and basically got told to do what I'd already done: upload all the files again. Then they said they'd have a go themselves if I uploaded the unextracted backup I'd made on the original server. Still no dice.

So then they suggested disabling all Wordpress plugins — already done — and themes. I couldn't even log in to the site's control panel to do that so changed the theme settings manually in the database which did indeed bring both the control panel and the front end of the site back to life. But of course, it looked like the default TwentyTen theme which wasn't much good to me. So I enabled the ShopperPress theme again. The control panel was still working but the front end of the site turned to spaghetti again.

Right, so it's a problem with the theme itself, I thought. OK, all I have to do is update the theme. So I downloaded an up-to-date copy of ShopperPress, uploaded and all good. But I'd made some modifications to the store on its original server recently which I wanted to retain, so redownloaded only the theme files I'd made edits to and uploaded them to the new server. Bam! Spaghetti code was back. :?

Finally, I took fresh copies of the theme files again and manually added back in my changes after comparing the files in Kaleidescope and uploaded them to the new server, and this time my changes stuck and I didn't end up with a broken site.

Using edited files from the original server, which worked fine on that server, killed the site on the new server, but using files directly from the theme download which were then edited, didn't. :? The only thing I can think of that might have made a difference is that the files that were edited were done so by mounting the old server as a disk using Transmit, whereas the changes I made for the files for the new server were done locally before being uploaded. Shouldn't make a difference, but it's the only thing I can think of.

All up, there was about five hours wasted trying to get to the bottom of this problem. In cases where I've battled against a problem but eventually found a solution, the consolation over all the time spent is usually a lesson or some new skills learnt, but in this case I don't think I really came away with anything worthwhile.