{"id":4454,"date":"2019-03-18T15:03:12","date_gmt":"2019-03-18T21:03:12","guid":{"rendered":"https:\/\/www.whitefirdesign.com\/blog\/?p=4454"},"modified":"2019-03-18T15:03:12","modified_gmt":"2019-03-18T21:03:12","slug":"fixing-missing-sessions-database-table-error-after-upgrading-to-zen-cart-1-5-6","status":"publish","type":"post","link":"https:\/\/www.whitefirdesign.com\/blog\/2019\/03\/18\/fixing-missing-sessions-database-table-error-after-upgrading-to-zen-cart-1-5-6\/","title":{"rendered":"Fixing Missing Sessions Database Table Error After Upgrading to Zen Cart 1.5.6"},"content":{"rendered":"<p>When doing a Zen Cart upgrade or any similar upgrade it is always a good idea to do a test of the upgrade first, since unexpected issues can come up and by doing a test first you can more easily work thorough those instead of trying to triage a broken production website. When we are <a href=\"https:\/\/www.whitefirdesign.com\/services\/zen-cart-upgrade.html\">hired to do Zen Cart upgrades<\/a> we always do that.<\/p>\n<p>That came in handy during a recent upgrade from Zen Cart 1.5.5a to 1.5.6a where we ran into what is an obscure enough issue we couldn&#8217;t find any mentions of it when we were troubleshooting it.<\/p>\n<p>After we ran the database updater we found that the instead of being served the website we got an error message, &#8220;An Error occurred, please refresh the page and try again.&#8221;.Looking at the related error log file in the &#8220;logs&#8221; directory it was indicated that the sessions table didn&#8217;t exist in the database:<\/p>\n<blockquote><p>PHP Fatal error: 1146:Table &#8216;[databasebprefix]_sessions&#8217; doesn&#8217;t exist :: select value<\/p><\/blockquote>\n<p>Looking at the databases for the production website and the test we found that the table existed prior to the database update, but not after.<\/p>\n<p>Looking at the database changes made during the 1.5.6 update we found that the table is dropped and recreated, so for some reason the recreation was failing.<\/p>\n<p>In looking at the debug log for the database updater we found that there were multiple errors like this:<\/p>\n<blockquote><p>MySQL error 1273 encountered during zc_install:<br \/>\nUnknown collation: &#8216;utf8mb4_general_ci&#8217;<br \/>\n) ENGINE=InnoDB;<\/p><\/blockquote>\n<p>After looking at various things we found that in the configuration file, configure.php, for the frontend of the website the &#8220;DB_CHARSET&#8221; was undefined. Defining that as &#8220;utf8&#8221;, re-importing the database, and starting the database update process over resolved the errors and the table was properly recreated.<\/p>\n<p>Further in the process we found the apparent reason for the &#8220;DB_CHARSET&#8221; being missing , it was causing characters to be improperly encoded, which we were able to resolve by simply changing the charset to proper one for those characters.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When doing a Zen Cart upgrade or any similar upgrade it is always a good idea to do a test of the upgrade first, since unexpected issues can come up and by doing a test first you can more easily work thorough those instead of trying to triage a broken production website. When we are &hellip; <a href=\"https:\/\/www.whitefirdesign.com\/blog\/2019\/03\/18\/fixing-missing-sessions-database-table-error-after-upgrading-to-zen-cart-1-5-6\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Fixing Missing Sessions Database Table Error After Upgrading to Zen Cart 1.5.6&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[],"class_list":["post-4454","post","type-post","status-publish","format-standard","hentry","category-zen-cart"],"_links":{"self":[{"href":"https:\/\/www.whitefirdesign.com\/blog\/wp-json\/wp\/v2\/posts\/4454","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.whitefirdesign.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.whitefirdesign.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.whitefirdesign.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.whitefirdesign.com\/blog\/wp-json\/wp\/v2\/comments?post=4454"}],"version-history":[{"count":8,"href":"https:\/\/www.whitefirdesign.com\/blog\/wp-json\/wp\/v2\/posts\/4454\/revisions"}],"predecessor-version":[{"id":4464,"href":"https:\/\/www.whitefirdesign.com\/blog\/wp-json\/wp\/v2\/posts\/4454\/revisions\/4464"}],"wp:attachment":[{"href":"https:\/\/www.whitefirdesign.com\/blog\/wp-json\/wp\/v2\/media?parent=4454"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.whitefirdesign.com\/blog\/wp-json\/wp\/v2\/categories?post=4454"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.whitefirdesign.com\/blog\/wp-json\/wp\/v2\/tags?post=4454"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}