0

Applied the 5.3.2 patch to our WP site yesterday, and in so doing upgraded the database to 5.6.alpha1. After doing this, multiple components (Contributions, Events, Mailing) became unusable. Trying to access these caused 500 (server) errors. Meanwhile, Civi 5.4.1 dropped, so I replaced the 5.3.2 patched code with 5.4.1 -- but couldn't update the database, because it was still 5.6.alpha1.

"No problem," I thought -- I can restore the WP database from a backup. But the only backup I had was from after the 5.3.2 patch, i.e. in the 5.6.alpha1 state. And as luck would have it, the hosting provider's backup on the server was corrupt and couldn't be restored.

So here's my dilemma. System Status tells me I need to "determine the correct version corresponding to your current database state." Should I try to manually alter the working database so it aligns with the 5.4.1 codebase (and if so, how do I even begin to do that)? Or do I try to reapply the 5.3.2 patch and hope to somehow fix the server errors? Or do I apply a different codebase entirely?

The error message also suggests fixing the file civicrm-version.php -- so I set the 'version' value to '5.4.1' but no luck. I still get this:

Your database is marked with an unexpected version number: 5.6.alpha1. The v5.4.1 codebase may not be compatible with your database state. You will need to determine the correct version corresponding to your current database state. You may want to revert to the codebase you were using until you resolve this problem. OR if this is a manual install from git, you might want to fix civicrm-version.php file.

How best do I fix this? And since Civi appears to be running okay right now despite having different codebase and database versions, is it possible the database version is somehow misidentified -- that the DB version is really 5.4.1, but identifies itself as 5.6.alpha1? Images (bottom) showthe current DB structure.

As an aside, I've just learned a valuable lesson. Always store a DB backup locally before starting an upgrade, even when two automatic backup systems are running. If I had backed up manually, right now I'd be moving other projects forward instead of trying to remedy this version mismatch on an active production site.


DB structure img 1 DB structure img 2 DB structure img 3 DB structure img 4 DB structure img 5 DB structure img 6 DB structure img 7 DB structure img 8

  • How did you update the database without changing the codebase to 5.6.alpha1? It is required to keep the codebase and the db version same for civi to run correctly. – jitendra - fuzion Sep 9 '18 at 5:59
  • Thanks for your question. I'm fairly new to git and command lines, so maybe I botched something when applying the 5.3.2 patch. After applying the patch and updating the DB, I was expecting Status to report the new version as 5.3.2, but it reported 5.6.alpha1 instead. And with no usable DB backup, I'm at a loss as to how best to proceed. – Prónay Sep 9 '18 at 13:57
  • It appears that your database is at 5.6alpha1 so would it not be sensible to make the codebase the same? But first clear caches and erase the templates_c folder. That should get you to a stable and possibly usable position. From there you can determine your next step, which might be to stay with 5.6 – Andy Clark Sep 9 '18 at 15:35
  • Thanks Andy -- I was wondering about that, but turns out the solution was to change the Version value in the civicrm_domain table and clear the caches. Apparently the DB was already 5.4.1 (which matches the current codebase), but for reasons unknown had the wrong version identifier. When I tried to update the DB just now, I got the red-font-yellow background error message with the explanation "Your database has already been upgraded to CiviCRM 5.4.1" -- so grinning happily and heaving a sigh, I'm back on track now. :) – Prónay Sep 9 '18 at 17:49
  • I'm so glad it's fixed - that was a horrible situation for you. – Andy Clark Sep 10 '18 at 17:10
2

Ahh did you upgraded to unstable version of CiviCRM? The last stable release i see is 5.4.1. Try replacing the civicrm code base to 5.4.1 and then update the civicrm_domain.version to 5.4.1 and also truncate all cache tables and anything under template_c folder.

  • That did the trick in short order! Already had installed the 5.4.1 codebase; it was the database that had me flummoxed. But after reading Pradeep's answer, I used phpMyAdmin to "SELECT * FROM civicrm_domain" and then "UPDATE civicrm_domain SET version = '5.4.1' WHERE civicrm_domain.id = 1;" ... then I used the Civi Admin (Administer / System Settings / Cleanup Caches and Update Paths) to finish up. Everything is good now, so THANK YOU! :) – Prónay Sep 9 '18 at 17:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.