Problems Upgrading OpenEMR 5.0.0 to 6.0.0 ~ solved ...?

Hello All,

I’ve been running openemr v5.0.0 (7) on ubuntu 16.04 and am attempting to migrate / update to v6.0.0 on ubuntu 20.04 and am currently encountering an issue (?) while running sql_upgrade.php from my web browser …

After the start of the 5.0.0 upgrade,

  • Start watching server processes for upgrade version 5.0.0

I get many hundreds of the following error messages …

Query Error

ERROR: query failed: SELECT value FROM keys WHERE name = ?

Error: Table ‘openemr.keys’ doesn’t exist

/var/www/html/openemr/src/Common/Crypto/CryptoGen.php at 424:sqlQueryNoLog
/var/www/html/openemr/src/Common/Crypto/CryptoGen.php at 153:collectCryptoKey(six,a,database)
/var/www/html/openemr/src/Common/Crypto/CryptoGen.php at 66:coreEncrypt()
/var/www/html/openemr/src/Common/Crypto/CryptoGen.php at 448:encryptStandard()
/var/www/html/openemr/src/Common/Crypto/CryptoGen.php at 153:collectCryptoKey(six,a,drive)
/var/www/html/openemr/src/Common/Crypto/CryptoGen.php at 66:coreEncrypt(lpr -P HPLaserjet6P -o cpi=10 -o lpi=6 -o page-left=72 -o page-top=72,drive,six)
/var/www/html/openemr/sites/default/config.php at 23:encryptStandard(lpr -P HPLaserjet6P -o cpi=10 -o lpi=6 -o page-left=72 -o page-top=72)
/var/www/html/openemr/interface/globals.php at 494:require_once(/var/www/html/openemr/sites/default/config.php)
/var/www/html/openemr/library/ajax/sql_server_status.php at 20:require_once(/var/www/html/openemr/interface/globals.php)

Followed by what appears to be successful table modification with no further errors … ?

  • End watching server processes for upgrade version 5.0.1
  • Start watching server processes for upgrade version 5.0.2

88% v5.0.2

Processing 5_0_0-to-5_0_1_upgrade.sql…

I’ve read about the new database encryption and suspect that this is part of my problem. I am ‘practicing’ the upgrade on a different server that I have upgraded to ubuntu 20.04. I have moved the mysql openemr database over to the new machine and have CREATEd an ‘openemr’@‘localhost’ USER with the same mysql_native_password and have GRANTed ALL PRIVILEGES ON openemr.* TO ‘openemr’@‘localhost’;

Is the missing openemr.keys table an issue and how do I solve it … ?

Thank you very much,

Thomas E. Shepherd


OK - I’ve got a bit further, I “merged” my old sites/default/documents directory with the new one and chmod(ed) 777 it …

When I reran the sql_upgrade.php, I encountered no visible errors.

But when I examine the apache error.log, I see the following …

[Wed Jan 27 20:14:00.657746 2021] [php7:notice] [pid 48945] [client 127.0.0.1:48638] OpenEMR Error : Key creation is not working - Exiting., referer: [edit]://localhost/openemr/sql_upgrade.php
[Wed Jan 27 20:14:00.667602 2021] [php7:warn] [pid 48945] [client 127.0.0.1:48638] PHP Warning: file_put_contents(/var/www/html/openemr/sites/default/documents/logs_and_misc/methods/sixa): failed to open stream: Permission denied in /var/www/html/openemr/src/Common/Crypto/CryptoGen.php on line 448, referer: [edit]://localhost/openemr/sql_upgrade.php
[Wed Jan 27 20:14:00.667653 2021] [php7:warn] [pid 48945] [client 127.0.0.1:48638] PHP Warning: file_get_contents(/var/www/html/openemr/sites/default/documents/logs_and_misc/methods/sixa): failed to open stream: No such file or directory in /var/www/html/openemr/src/Common/Crypto/CryptoGen.php on line 462, referer: [edit]://localhost/openemr/sql_upgrade.php
[Wed Jan 27 20:14:00.667670 2021] [php7:notice] [pid 48945] [client 127.0.0.1:48638] OpenEMR Error : Key creation is not working - Exiting., referer: [edit]://localhost/openemr/sql_upgrade.php
[Wed Jan 27 20:14:22.205845 2021] [php7:warn] [pid 48947] [client 127.0.0.1:48646] PHP Warning: file_put_contents(/var/www/html/openemr/sites/default/documents/logs_and_misc/methods/sixa): failed to open stream: Permission denied in /var/www/html/openemr/src/Common/Crypto/CryptoGen.php on line 448
[Wed Jan 27 20:14:22.205877 2021] [php7:warn] [pid 48947] [client 127.0.0.1:48646] PHP Warning: file_get_contents(/var/www/html/openemr/sites/default/documents/logs_and_misc/methods/sixa): failed to open stream: No such file or directory in /var/www/html/openemr/src/Common/Crypto/CryptoGen.php on line 462
[Wed Jan 27 20:14:22.205883 2021] [php7:notice] [pid 48947] [client 127.0.0.1:48646] OpenEMR Error : Key creation is not working - Exiting.

So it looks like I’m needing the ‘sixa’ and maybe the ‘sixb’ keys … ?

I’m not sure how to proceed from here.
Please suggest a next step.

Thank you,

Thomas E. Shepherd

UPDATE ~ I had been using …

  • Administration -> Other -> Database -> Export -> Go ( Format : SQL )

And this time I am trying …

  • Administration -> Backup -> Create Backup

And the size of the imported database is different, so apparently something is different between the two processes.


The imported database is lacking a “keys” table, and the sql_upgrade converting from 5.0.0 is still throwing the same errors …

I had upgraded from an original 4.1.1 installation back in 2017 (?).


It seems that the primary problem remains the missing encryption keys … (?)

PHP Warning: file_put_contents(/var/www/html/openemr/sites/default/documents/logs_and_misc/methods/sixa): failed to open stream: Permission denied in /var/www/html/openemr/src/Common/Crypto/CryptoGen.php on line 448, referer: —://localhost/openemr/sql_upgrade.php

PHP Warning: file_get_contents(/var/www/html/openemr/sites/default/documents/logs_and_misc/methods/sixa): failed to open stream: No such file or directory in /var/www/html/openemr/src/Common/Crypto/CryptoGen.php on line 462, referer: —://localhost/openemr/sql_upgrade.php

OpenEMR Error : Key creation is not working - Exiting., referer: —://localhost/openemr/sql_upgrade.php


Closer, I fixed the “missing sixa” issue … somehow permissions were not systematically set in the /sites/default/documents folder …

Running sql_update.php from my web browser after

 sudo chmod 777 -R documents

fixed this problem by brute force …


This is the dominant problem in the apache log now …

PHP Notice: Undefined index: gbl_force_log_breakglass in /var/www/html/openemr/src/Common/Logging/EventAuditLogger.php on line 520, referer: -://localhost/openemr/sql_upgrade.php


it may be working now … ?

OK - OpenEMR seems to be working on my practice ubuntu 20.04 server.
Now to start the real upgrade …

I will update this when successful.

Thomas E. Shepherd

1 Like

OK - Billing Manager selection Criteria is not working with any of the Date options, e.g. Date of Service = Today yields every patient encounter in the database …
If I set the selection criteria to Encounter = 256, the search returns the single encounter …

I suspect that this has something to do with mysql 8 but I am at a loss and would really appreciate some guidance debugging what is wrong with my installation.

This is for a small medical practice and I must get this working …

Thank you - Thomas E. Shepherd