…they generally go very wrong and when the cause of a website crash isn’t immediately apparent, putting things right can be a challenging exercise. The above image is what confronted me following an aborted forum software upgrade last week, indicating that the flux capacitors had blown somewhere along the line and immediate action was required to rectify the situation. Here’s how it all started.
An important update to my forum became available, adding many new features and so I decided to upgrade. First, I read the upgrade instructions on the developer’s website, made a backup of the entire site through CPanel, where you are given the choice of what type of backup you require. So, as normal I chose a full backup, which I then downloaded to my PC. I also made a separate backup of the database just in case and then placed the forum into maintenance mode. Half-way through the upgrade the process froze, so I left it for an hour or so hoping it would complete the process.
Eventually, I had to abort by refreshing the page and quickly realised that all I had was a half-upgraded website and as we all know, uncompleted upgrades are like incomplete car restorations. They simply don’t work.
Restore The Website Through CPanel?
There’s a commonly held view that restoring a website backup through CPanel will magically switch on a beautiful time machine and when you hit restore, your precious website will be put back to where it was before disaster struck. I am one of those misguided fools and it was only when the penny dropped that I realised the error of my ways. CPanel simply creates a compressed folder archive of what you have asked to be backed up; in my case the entire home directory which includes all the website folders, unique hosting files and the very important databases, all in the form of a compressed .tar.gz folder for downloading to a local PC. Conversely, restoring the compressed folder through CPanel decompresses that folder into a newly created directory within the home directory which in my case was named Backup-date-xxxxx, etc.
A full backup will create an archive of all the files and configurations on your website. You can only use this to move your account to another server, or to keep a local copy of your files. You cannot restore full backups through your cPanel interface. CPanel.
This explains why I wasn’t able to activate my imaginary time machine since the restore function was simply restoring a copy of the backup into the home directory and not overwriting the entire structure of the root directory, as can be seen below. Or to put it another way, I was under the misconception that the CPanel full restore would restore an image (like a Windows disk image) of a previous moment in time and all would be fine and dandy. Not so.
All the crucial website folders and files are kept in the public_html directory and with a half-upgraded forum in there, I needed to somehow restore the backup public_html directory, either from my local copy or the restored backup, which was now in place after using the CPanel restore function. Whilst mulling over my options I then asked for help in the forums of the software developers, contacted GoDaddy through their very useful and secure online chat system, where I was advised to carry out a full restore (again), after which my website would be back to normal as if nothing had happened. That didn’t happen of course and later on I was a little surprised at the lack of knowledge shown by the agent, but that’s an entirely different matter.
Decompress Your Backup Locally And FTP Upload Manually
This wasn’t difficult, especially with 7zip which will decompress virtually anything and it’s free of charge (there’s a meme somewhere of someone who actually paid for WinRar!). In this case it needs to be decompressed twice, first the .gz element, and then the .tar.
Once decompressed, I opened up FileZilla, a free FTP program for transferring files over the net and proceeded to upload the backed up public_html folder, overwriting the the existing folder. This wasn’t successful as many folders failed to upload, so I went back to CPanel, deleted the public_html directory and used the CPanel copy function on that folder instead. This worked at first, but then the site crashed again during the second upgrade attempt, which is when I decided that enough was enough and enlisted the help of a senior developer at WoltLab. He then managed to not only restore the forum, but also to upgrade it to the current version.
Now, there’s nothing worse than not knowing how something was fixed, and as far as I can gather, instead of uploading the public_html directory manually through FileZilla, this was done manually through some other FTP as well as restoring the database. The original update freeze was encountered again by the Dev (indicating that I hadn’t screwed it myself), but with additional tools at his disposal he was able to recover the upgrade and finish it with success. I’ll probably never know exactly what he did, but I have learned that a CPanel restore should not be regarded as the magic tool I always incorrectly imagined it to be. Suffice to say that I will continue to carry out regular backups of the website regardless of how they may be used to restore it again in the future, black magic or not.