Upgrading from 4.2.0 to OpenEMR 5.0.0

Experts, please advice. Is it ok to upgrade from OpenEMR 4.2.0 to OpenEMR 5.0.0?
Should I upgrade
from 4.2.0 to 4.2.1
from 4.2.1 to 4.2.2
from 4.2.2 to 5.0.0.

Thanks a bunch!

1 Like

hi @smirzaoe
You should be able to do it in a straight shot(ie. from 4.2.0- to 5.0.0). Definitely rec running upgrade on a testing instance first to ensure all goes well.


Thanks for your quick response. Appreciate it!

Hi Brady,

I have a couple of questions on the 5.0.0 upgrade process

We’re on Ubuntu 14.4 with Oemr 4.2.0(4)

The PHP5 version of the Ubuntu 5.0.0 upgrade wants to see the openemr directory at /var/www/ and ours
has been at /var/www/html since we upgraded to 14.4.
Can I copy the openemr directory to /var/www to run the upgrade and then move it back? or would I be better off upgrading the OS to 16.4 and then using the PHP7 version of the upgrade?

Also, we have extensive customization’s, so where can I get a list of the files to be replaced in the 5.0.0 upgrade.

Lastly, our fallback/backup plan involves using an identical off-site server that gets a nightly sql dump and the openemr directory restored to it. I read that MySQL is no longer used in 5.0.0 and I know nothing about it’s replacement. Will this require us to re-vamp the fallback/backup plan?


hi @hitechelp ,

In this case, probably makes sense to just move it to /var/www and then run the OpenEMR 5.0.0 ubuntu package to get the upgrade going(note you won’t need to move it back to /var/www/html since the upgrade will also bring in alias setting into apache for the path at /var/www to work). This will work fine in Ubuntu 14.04.

Then will need to migrate it to 16.04 in the future before you go to 5.0.1 (this won’t be released for another, at least, 2 months).

Regarding customization, this is tricky since an upgrade will replace all your code customizations. I usually recommend using git to track customizations and help with getting them back into your upgraded version. If uncomfortable with this, then would rec finding a pro to help.

Mysql is still used in OpenEMR (MariaDB can also be used, which is maybe where the misunderstanding came from).

With all the stuff above, always recommend using a non-production instance to test it out on before upgrading your production server.


Hi guys,

Finally we started the upgrade process with upgrading our Test environment.

We were running Ubuntu 12.04. So we first upgraded Ubuntu to 14.04. Which went on fine. After that we ran the below commands to upgrade the OpenEMR:

From: https://www.open-emr.org/wiki/index.php/Ubuntu_Package_Upgrade_to_5.0.0_with_PHP5

  1. Download and Upgrade (commands are in red):
    wget downloads.sourceforge.net/openemr/openemr-php5_5.0.0-2_all.deb
    sudo apt-get update
    sudo dpkg -i openemr-php5_5.0.0-2_all.deb

The third command failed with the below message:

│ │
│ This package can not upgrade OpenEMR, because unable to confirm presence │
│ of a mysql credentials and/or database. │
│ │

We also ran the below command but no luck.

sudo apt-get install -f

Any help is appreciated.


Some additional information on the error:

ubuntu@:~$ sudo dpkg -i openemr-php5_5.0.0-2_all.deb
(Reading database … 101870 files and directories currently installed.)
Preparing to unpack openemr-php5_5.0.0-2_all.deb …
dpkg: error processing archive openemr-php5_5.0.0-2_all.deb (–install):
subprocess new pre-installation script returned error exit status 1
postrm asked to do abort-upgrade from version 4.2.0-1
postinst asked to do abort-upgrade
Errors were encountered while processing:

hi @smirzaoe ,

What is the path of your openemr instance (ie. /var/www/openemr or something else?)?


Hi Brady,

The path of my openemmr instance is /var/www/openemr


Do I need to worry about the file and folder permissions?

hi @smirzaoe ,

Can you paste here what you see in the following files:
/etc/openemr/<the only file here- forgot the name of it>
/var/log/openemr/<the only file here- forgot the name of it>


Hi Brady,

I looked into the install file from one of these folders and I see my issue. Seems like we had bad credentials for one of the databases. We didn’t notice because this is a test region. Thank you so much for your reply. We should be able to make progress after fixing the db credentials issue.

Thank you!

We were successfully upgraded the OpenEMR to 5.0.0. We haven’t applied the 5.0.0 Patch (12/04/17) yet.

Got the login page. After entering the username and password, we got this

ERROR: insert failed: insert into log ( date, event,category, user, groupname, success, comments, crt_user, patient_id) values ( NOW(), ‘login’,‘login’,‘admin’,‘Default’,‘1’,‘success:’,NULL,NULL)

Error: Unknown column ‘category’ in ‘field list’

/var/www/openemr/library/log.inc at 45:sqlInsertClean_audit
/var/www/openemr/library/authentication/login_operations.php at 116:newEvent(login,admin,Default,1,success:
/var/www/openemr/library/auth.inc at 50:validate_user_password(admin,Default)
/var/www/openemr/interface/globals.php at 449:include_once(/var/www/openemr/library/auth.inc)
/var/www/openemr/interface/main/main_screen.php at 25:require_once(/var/www/openemr/interface/globals.php)

Trying to read the forum for help. Seems like below two threads are for similar issue:

Not sure what to do at this time. Should I apply the patch 5.0.0 Patch?

Can you please check whether you have run the sql_upgrade.php.If not can you please check by executing the file.



The ubuntu package should of run sql_upgrade.php and would check the /var/log/openemr/<the only file here- forgot the name of it> to see why the upgrade didn’t run correctly. Also, what do you see if go to admin.php in your browser?


Good morning guys,

Thank you for the quick responses. I had tried running sql_upgrade.php but I got “HTTP ERROR 500”. I ran sql_patch.php which appeared to ran successfully, though I am not sure if I should have ran that or not.
I ran sql_upgrade.php still getting that “HTTP ERROR 500”.

That being said, thanks to Brady I went to admin.php and I see the page shown below which is great. I am able to login to the sites which are showings as version 5.0.0. However, when I click on “Upgrade Database” link next to 4.2.0, still getting that HTTP 500.

hi @smirzaoe ,

The ubuntu package (for security reasons), changes permissions to sql_upgrade.php script after install/upgrade is complete. So, you just need to change permissions to that script (allow all to read) and then it will work (after done using it , recommend again changing it to the strict permissions).

As an aside, it appears your are using multisite and the ubuntu package should upgrade each of these, so appears something may of gone wrong there. Feel feel to email me your /var/log/openemr/<the only file here- forgot the name of it> at brady.g.miller@gmail.com (and we can ensure there isn’t a bug in the package), if you aren’t comfortable pasting it publicly.


Thanks Brady. I changed the file permission of sql_upgrade.php and ran it. After running for a few minutes, it failed with the below message at the end of the file. I will email you the install.log file from /var/log/openemr/

Processing 4_2_2-to-5_0_0_upgrade.sql …

Skipping section #IfTextNullFixNeeded
ALTER TABLE ar_activity MODIFY sequence_no int UNSIGNED NOT NULL COMMENT ‘Sequence_no, incremented in code’
ALTER TABLE ar_activity ENGINE=“InnoDB”
ALTER TABLE claims MODIFY version int(10) UNSIGNED NOT NULL COMMENT ‘Version, incremented in code’
ALTER TABLE procedure_answers MODIFY answer_seq int(11) NOT NULL COMMENT ‘Supports multiple-choice questions. Answer_seq, incremented in code’
ALTER TABLE procedure_answers ENGINE=“InnoDB”
ALTER TABLE procedure_order_code MODIFY procedure_order_seq int(11) NOT NULL COMMENT ‘Supports multiple tests per order. Procedure_order_seq incremented in code’
ALTER TABLE procedure_order_code ENGINE=“InnoDB”
Starting migration to InnoDB, please wait.
ERROR: query failed: ALTER TABLE layout_options ENGINE=?

Error: The used table type doesn’t support FULLTEXT indexes

/var/www/openemr/library/sql_upgrade_fx.php at 297:sqlStatement
/var/www/openemr/library/sql_upgrade_fx.php at 653:MigrateTableEngine(layout_options,InnoDB)
/var/www/openemr/sql_upgrade.php at 56:upgradeFromSqlFile(4_2_2-to-5_0_0_upgrade.sql)


I tried re-running sql_upgrade.php to upgrade database from 4.2.2. to 5.0.0. but got the same above error. I don’t know what else to try.

hi @smirzaoe,
What Mysql/MariaDB version are you using?