{"id":2748,"date":"2018-08-22T10:13:36","date_gmt":"2018-08-22T17:13:36","guid":{"rendered":"http:\/\/www.wellgolly.com\/?p=2748"},"modified":"2018-08-22T11:27:39","modified_gmt":"2018-08-22T18:27:39","slug":"updating-ubuntu-lts","status":"publish","type":"post","link":"https:\/\/www.wellgolly.com\/?p=2748","title":{"rendered":"Updating Ubuntu LTS"},"content":{"rendered":"<p>I have a small site that was running Ubuntu 16.04 LTS and upgraded it to 18.04 with no issues. I have a couple of customizations in my php.ini and the location where I store my email and because I accepted the maintainer\u2019s version of the PHP and Exim4 files, I had to update a few files to get everything working as before. Not a big deal and the whole process took about a half hour.<\/p>\n<p>On my main site, I was running Ubuntu 14.04 LTS and it was a major project to update. There were times that I considered reverting to the snapshot I took just before I started the update process, but I got everything working about the same as it was before. <\/p>\n<p>The first issue I encountered was with the update to the Linux kernal. The instructions recommended that I go to the Linode control panel and change the Boot Settings Kernel to Grub. When I did that, the server wouldn\u2019t reboot. So I picked the Latest 64 bit version instead and rebooted fine.<\/p>\n<p>Because I was on an older version I had to update in stages. Somewhere along the line it messed up my MySQL install. So I removed MySQL and installed MariaDB. That ended up causing a lot of work which I\u2019ll get to later.<\/p>\n<p>Restoring mail service was pretty straightforward\u2014just changing the location of the virtuals files.<\/p>\n<p>After working through the install process I loaded all of my sites and some displayed properly, some displayed without most of the formatting and some displayed a blank page. It took a while to figure out what was going on. WordPress sites weren\u2019t displaying because of database access issues. There was lots of really weird behaviour on the other sites that I eventually tracked down to permissions problems on a shared styles folder. For example, if I accessed a site with sitename.com things looked fine. But if I accessed it with www.sitename.com, I got no formatting. And in one case it redirected to the default site for the server. It took quite a while to figure out what was happening but eventually I tracked it down to a permissions problem. I keep styles that I use on all my sites in a sim-linked folder in <em>\/www\/common\/Styles<\/em>. After I changed all of the file permissions to -rw-rw-r&#8211; and the directory permissions to dr-xr-xr-x, the sites started behaving normally.<\/p>\n<p>The MySQL issues were much more difficult to resolve and took the better part of two days. There were enough changes to the <em>users<\/em> file that I couldn\u2019t just copy it into <em>\/var\/lib\/mysql<\/em>. I went with the default install and then took then loaded users (and their database permissions) from my mysqldump from the night before. I took the opportunity to delete users who no longer needed access to the system and clean up some of the permissions on those who remained.<\/p>\n<p>Copying the sql files from a backup copy worked for most tables, however there were some that only had a .frm file and no MYD and MYI file. PhpMyAdmin showed them as being \u201cin use\u201d and would not display their contents. I reloaded their contents from the mysqldump. That solved most of my website display problems, but I couldn\u2019t log into any WordPress installations. That turned out to be a permissions problem. I changed the user and group of all the sql files to mysql and then changed all of the permissions on the files to -rw-rw-r&#8211;  and folders to drwxr-xr-x. Now all of my sites were displaying properly.<\/p>\n<p>The only problem was with the order confirmation page. I got an error <span class='typewriter'> Cannot start session when headers already sent<\/span> error. I had a redirect on one page that was in fact trying to redirect after some html had already been sent. Not sure why it worked before, but putting in a conditional to not load the html if the page was going to be redirected fixed it.<\/p>\n<p>The order page still didn\u2019t work and the reason was that it used <em>mc_encrypt<\/em> which is no longer supported in PHP 7.2. I updated the files to use <em>openssl_encrypt<\/em> and everything works as before. I didn\u2019t write the original order form code so it took a while to understand how the encryption works. There are lots of examples out there, including on the PHP.net site, so I won\u2019t go into detail about what I did. Understanding and implementing the new encryption method probably took around three hours. <\/p>\n<p>An older set of pages that used <em>mysql_real_escape_string<\/em> also failed to load because <em>mysql_real_escape_string<\/em> was no longer supported. In this case, replacing it with <em>htmlspecialchars<\/em> solved the problem and should have been what I used to begin with. This section of the site also had some date returns that did not correctly use the date function. I replaced <span class='typewriter'>$thisMonth = date(F); with $thisMonth = date(&#8216;F&#8217;);<\/span> and did the dame thing with <span class='typewriter'>$thisDay = date(d);<\/span><\/p>\n<p>For some reason, aptitude wasn\u2019t upgraded so I had to install it when I did the first update of the site.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a small site that was running Ubuntu 16.04 LTS and upgraded it to 18.04 with no issues. I have a couple of customizations in my php.ini and the location where I store my email and because I accepted the maintainer\u2019s version of the PHP and Exim4 files, I had to update a few &hellip; <a href=\"https:\/\/www.wellgolly.com\/?p=2748\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Updating Ubuntu LTS<\/span><\/a><\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-2748","post","type-post","status-publish","format-standard","hentry","category-coding"],"_links":{"self":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/2748","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2748"}],"version-history":[{"count":1,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/2748\/revisions"}],"predecessor-version":[{"id":2757,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/2748\/revisions\/2757"}],"wp:attachment":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2748"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}