THE GREAT MIGRATION |
I wasn’t sure if this belonged here or if it was better suited for the other section I do not want to take up your precious time and since this will be a lengthy post, if you don’t want to read the backstory feel free to skip right to my tutorial: “Using Softaculous to successfully migrate a WordPress installation from an old server to a new one”.
With that out of the way the backstory on the challenging circumstances I was faced is way to interesting to not include it in post
The experts in website design and development say to us all the time, it is not just a probability but a definite that we will encounter a client with a rare set of issues we may not be able to solve. I can assure you, they aren’t kidding. These unique moments define us by either our triumph or our failure. The important take away I get from these moments: Even when we do it all wrong, simultaneously we are taught at least one way it can’t be done.
It is also true, when put to the challenge of finding a solution, this is when we are truly forced to learn a new set of skills. There are no words to describe the thrill and excitement I get from succeeding when the cards are stacked against me. What I can say is that actually solving the problem is what I love most about development.
The Back Story:
I had a client who recently came to me with an almost impossible problem to fix. Even worse, I had only 24 hours to come up with an answer. My client had been hosting his website on the same server since 2010. During the 7 years, the UK based hosting company merged with another UK hosting company I assume because they more structured to handle the larger demand of user members signing up.
My client for the sake of this story, I’ll name Mr. Lucky. He was not aware of the company merge and luckily, his account and his backend admiration seamlessly merged without any complications or downtime. Even more rare, somehow during the migration of the servers, his account and his website got lost in the move. His account was still active along with his Cpanel and server. What didn’t get properly ported over to the new system during the merge was his payment processing. To his surprise and mine 7 years had past sand this mistake went undetected. Yet, there was never any downtime; remarkable, I know! Mr. lucky was about to run out of luck
All good things must come to an end. A few months ago his site went down. He only noticed because he was going to do an update and was denied ftp access. Thinking he merely was typing in the wrong credentials, he tried to get into Cpanel and was again denied accsess. This concerned him which in return, led him to check his website. It too was down and displaying a DNS error message he had not seen before. It is when he logged into his account, he became aware of the company change. He did a password reset and was able to log into an account he wasn’t aware was his much different than his original one.
Mr. Lucky became more concerned after trying to get to the bottom of what was happening, he saw that his payment history hadn’t been active in 7 years. He never once got an email nagging for payment nor did his site go down. The real issue, he soon realized and most afraid of was that while he had access to his profile and account he had active service product.
He quickly spoke with support and they told him what he suspected; after looking into it, an automated audit finally detected the rouge account, deactivated it, and wiped the entire server space where his site was hosted. Mr. Lucky had no current backup and no access to the server.
Thankfully, they had a backup of Cpanel and told him they would restore it, reactivate his backend server but his frontend would remain blocked until he could pay the last 7 years worth of unpaid service because after all, there was no down time.
I will not dive into specifics on the legality surrounding this highly unlikely set of events that occurred. I’ll only say, in my opinion, it was nice of them to give him back the access so at least he could download a crude backup of his site and database. Although, with this in mind, I personally think that what was clearly and ultimately their oversight, should probably not have been entirely all of his financial burden.
Here is where I get brought into the equation. With access to both Cpanel and ftp access, they were giving him 24 hours of access so he could get as much as he could during that time, but they wouldn’t be able to assist him nor give him a backup of his site unless his account was paid to a current zero balance.
His questions to me: Is there any way to clone and migrate his site to a new server without having access to his WordPress Dashboard and Admin Area? My initial response was it was more than likely, it would be impossible but I’d see what I could do. In case you were curious why he didn’t just pay the balance which I also asked, the account was a basic account that wasn’t even an option under the current company. The server space and features were not even what we have become accustom to seeing as an industry standard among popular competing hosting providers. In fact, ironically his current set up was now comparable to their free plan. Plus, a mistake undetected for seven years didn’t give him confidence in their security to handle his sensitive data. I would have also wanted to move on for that same reason.
Using Softaculous to successfully migrate a WordPress installation from an old server to a new one
The first thing I did Once I had access to his panel was make two different types of backups. One from the backup section of his entire root in case I had to reconstruct his site the hard way. Then I did a site backup using Softaculous and downloaded that.
The Problem:
There were several hurdles I was faced with. The first one: Although Softaculous is an amazing solution for cloning your WordPress site, it is meant for backing up your site to obtain a local copy in case you loose everything and need to restore it to the same server. Softaculous easily clones a site but again it is meant to easily set up either a staging environment or to easily move it into a different directory. Softaculous does not give us the ability to clone a site, download it and then upload it to an entirely new server. The environments are drastically different. The second problem: His site was not live and I had no access to WordPress Admin area so cloning software was not an option.
After doing some research I stumbled across two unrelated threads talking about using Softaculous for the purpose of server to server migration. One of posts had a partial explanation of what would need yo be done which acted as a guide. However, it wasn’t complete and therefore it wouldn’t work as many users who had tried, experienced. The second post was from a user who had the missing part to make it work. It was time for me to try the impossible
The step by step guide to my solution:
Using Softaculous to successfully migrate a WordPress installation from an old server to a new one
Note: In order to write this guide, I decided to recreate the problem using an old server I only store files on and use for version control staging and testing. Then I cloned my live site for a safety precaution in case something went wrong.
I also assume that most of you understand how to use an FTP client and text editors like Sublime and have basic knowledge of Backend Admin Panels like Cpanel.
Step one:
-
Make a backup of your site using Softaculous within what will be your old server.
-
Next you’ll download it from Server #1 to your desktop using either the Softaculous interface or navigate to the softaculous_backups folder using your ftp client.
Step Two:
Either in the Cpanel from Server 1 or your ftp client, make sure you have chosen the option to view all hidden folders and files because the very small scripting file you will need to download and edit is hidden by default.
Step Three:
Go to the following directory (hidden by default)
.softaculous/backups on Server #1
Important! Do not get this confused with the directory
softaculous_backups because they are not the same.
Step Four:
Once you’ve navigated to the directory, you’ll look for the most recent log file created., download it to your desktop and add the .txt extension if you aren’t using a text editor like Sublime. Open it, and for me, I prefer to remove text wrap because it is easier to read the one line and find the parts I need to edit.
Step Five:
-
Go to your new server (server #2). If this is a brand new server and you have nothing installed yet you’ll need to at least use Softaculous to install a new installation of WordPress because like in Step Two, you’ll need it access to the newly created script file which is in the same directory you first found the log file from the old server.
-
Next Navigate to the log file on your new server. You can download it to your desktop and place it in separate area from the other log. This so you don’t get the two files confused because that would be bad.
-
The other option is to do as I did and just view it within Server #2’s Cpanel. It is easier because you can keep the browser open looking at the log string as one single line while you have your text editor open with the log file from the old server. I use Sublime so the two files look completely different so I don’t get them confused.
Here is where you get to do the important part. You are looking for a few different pieces of data from the log file on the new server (server #2). You need to copy them over onto the other log from Server #1 and this is the other reason I decided to turn word wrap off. It gives you more space to past them away from the string you’ll be editing.
If you know anything about the paths structure or are somewhat familiar with WordPress paths and codex, the string will look pretty familiar as you read it.
What you are looking for in the new scripting file from the new server are a few of the following things but you may need to look for more or less depending on the situation.
The root path where your new account sits.
Example: /home/mycloneds5/public_html/myclonedsite.com
Your WordPress database extension: It will have a prefix that uses the same root folder name followed by an underscore and then the database name.
> Example: mycloneds5_xxxdp
The name of script file that was created in case you need to replace i.
Example: wp.26_56437.2017-02-08_19-22-57
The last piece you are looking for you’ll find at the end of the string. It is the btime and the size.
> Exxample: btime";i:1499530977;s:4:"size";i:334304446;**
In step six, we will paste these into their correct places inside the file from the old server.
Step Six:
With your newly acquired info you want to paste only the important parts into every area where they come up in the string replacing the data with the information from the new server.
For example: Below are two string highlighting only the important pieces you need to replace.
/home/mycloneds5/public_html/myclonedsite.com
Example: mycloneds5_xxxdp
You only need to replace the root account name unless you were lucky enough to get the same root account name as your old server. You could also request your new Hosting Provider to change your account name to match your old server but there still would be other things in this file that may need to be replaced because everything in the string has to mimic the new script file.
Important! It is very important to make sure btime and size match exactly and there are a few different spots where these are repeated. The same goes for the database path. You may not need to change them but if you see differences, you will need to make sure they match
The file names from both the tar.gz file and the script file must also match.
Once you have made the necessary changes, make sure you remove the extra stuff you pasted in below that were your references,.
- Now save the file and remove the .txt extension if you still haven’t.
Step 7:
Upload newly saved file you just corrected into the same location on the new server,
i.e. .softaculous/backups.
Upload the actual .softaculous backup tar.gz File into the softaculous_backups folder that is not hidden by default.
i.e., .softaculous/backups
Step 8:
if you did everything correctly then when you go back into the Softaculous App Installer on your new server navigate to the Backups and Restore tab, you should see a new backup file but with some additional info below it.
If you do see that, and if everything was correctly matched up, you can try restoring your site to the new server and it should restore it without errors
Cleaning up
Step 9:
Okay if you have made it this far then one of the last few steps you’ll need to do is clone the new installation into a new folder and take note of what information you used during the setup.
Cloning is a necessary step because the restored site will still be incorrectly set up under the new server.
Step 10:
The last step is that you will need to make a few path changes inside phpMyAdmin so that you don’t continue to get the database error. Additionally I think I had to make a couple other tweaks but really Softaculous does a fantastic job of neatly packaging everything up,
The nest part is that, this is another option when migrating from your old hosting company to your new one. It also saved him from losing his entire website.
I hope this tutorial is useful. I have always wanted to give back to the large WordPress community of developers, designers and artists. Sadly, until today, I have never done so because of my busy and often chaotic schedule. You could only imagine my delight when by serendipitous circumstances such as this, finally encouraged me to compete in this contest. This just happens to be one of my favorite communities in the industry, so it is with great honor I I had the chance to post this tutorial.
Kyle and your “X Theme Dream Team” (which I just now came up with), you all have been inspirational to me as I have been on this long journey of mine learning about WordPress Development. What many don’t know is that in my full time career which I’ve been a part of more than 26 years. My success is entirely dependent on being able to quickly connect with people individually yet collectively they all a part of a large audience. It can be a big challenge but it’s my job to inspire them with my words, actions and my passion; this is what I love most about Kyle, and his team of developers. Just as interesting as it is to see ongoing evolution of X Theme, I have also paid close attention to their approach on how they actively engage with us. What separates them from the rest of the pack is how they manage to humanize their front facing company. Their dialog is genuine. We hear the frustrations and set backs just as much as we hear their celebration which is all the more rewarding when they take their victory lap before embarking on a new chapter in the Themco story.