Upgrading Ubuntu 14.04 to 16.04 for WordPress

So today I decided to take on an adventure of updating my WordPress from an ancient 4.x to 5.x.

I did my due diligence of backing up and take a snapshot from DigitalOcean (my VPS service provider) and then started the risky process. The WordPress upgrade itself was relatively smooth with no issues. Little did I know that I was jumping into something more serious…

The first I noticed after the upgrade was the awful new “Gutenberg” visual editor so I immediately switched back to old one using the Classic Editor plugin.

Then I noticed that the AMP plugin was not working as it required php 5.6, but I only had php 5.5. This is where I realized that my Ubuntu 14.04 is really old at this point and has reached its “End of Standard Support” so no php 5.6 for me.

What to do now? Update the Ubuntu 14.04 to the next LTS 16.04 of course. I doubled checked that 16.04 does have php 5.6 (for now) and went ahead with the DO guide on how to do so.

And boom! I was greeted with an error upon upgrading and re-sshing into the machine:

“-bash: cannot create temp file for here-document: Read-only file system”

And sure enough, Cloudflare was starting to give an error page when I tried to access my website.

A quick googling suggests that this issue was due to DO and that opening a support ticket was the best way to do so. So raised a ticket but continued to dig into it. On the upgrade guide, someone mentioned that it seemed to be a kernel issue, so I updated the kernel to the recommended “DigitalOcean GrubLoader v0.2 (20160714)”, but the error is still there.

Turns out that in the same askubuntu page, the second answer was more useful than the most voted one. I just need to get fix some UUID issue with the file system. Here is what I did from my bash history:

Then comes the problem where my apache2 was not starting due to some config issue in /etc/apache2/apache2.conf . After some googling, it seems to be an issue with deprecated php configs – php_flag and php_admin_value, so I went ahead and commented them out:

The next error that greeted me was on my website (paradite.com), it just rendered the content of /var/www/index.php as the HTTP response:

I know I had to do something with php, so I went back to the guide that teaches me how to upgrade php5.5 to php5.6 and installed php5.6 as well as its apache2 modules:

At this stage, my website was telling me “Error Establishing a Database Connection”, an error that I have seen too many times due to mysql service suddenly shutting down. However, this time it is different, no matter how many times I run sudo service mysql restart , it just exits immediately but there is also no error logs in /var/log/mysql/error.log. This got me quite confused for a while until I started checking my mysql pacakge installed on Ubuntu.

This is when I ran apt list --installed  and found out that I didn’t have mysql server pacakge installed! Somehow it went missing after upgrading from 14.04 to 16.04. The next step was simple: sudo apt-get install mysql-server  and mysql service automatically started and even repaired my old tables (a bit scary to see that this was required)!

At this stage, my WordPress website was finally rendering properly again! Though there were some issues with some WP plugins missing php extensions that was fixed easily:

And that’s it, welcome to Ubuntu 16.04 and WordPress 5.1.5! Not gonna update it any further for now!

Leave a Reply