Starting a new openemr computer with old data

I am still using OpenEmr 5.0.0
I have installed OpenEmr 7.0.0 on a new computer.
I would like to install the necessary files from my 5.00 server to my 7.0.0 server without messing with my 5.0.0 installation, for fear that something awful would happen and I would lose all my data.
on the 7.0.0 server, I can extract the emr-backup file to get the openemr.tar.gz and the openemr.sql.gz files. If I place the openemr.tar.gz file in the html folder and extract it, will the information be put in the correct places and will the installation remain the 7.0.0 release? What do i do with the sql file?

Can you give the details of your existing 5.0.0 and your “new computer”?
I know what I’d do in that scenario, but it might not be the same for you depending on the underlying platform.
It also depends on if, or how much, you’ve customized your working OpenEMR 5.0.0.

Actually, I setup openemr 7.0.0 on a computer running ubuntu. I extracted the documents file from my 5.0.0 emr_back.tar and I replaced the new 7.0.0 documents file with my backed up documents file. I then replaced the 7.0.0 sqlconf.php file with the sqlconf.php file from the backup. I tried to upgrade the database, but I found that the upgrade file would only work if I put the 7.0.0 sqlconf.php file back in the default directory. After upgrading the database, I typed in ‘localhost/openemr’ in my browser; the “login” file came up in the address bar, but nothing came up in the window. I think this is the proper way to upgrade, but it did not seem to work.

If by “setup” you mean that you ran through the full installation procedure on OpenEMR 7.0, then you have actually created a new, empty installation, rather than upgrading your existing database.
There are some new content folders under documents in 7 that were not present in 5, so replacing that directory in its entirety will have negative effects as well.
Also, double check your installed & active version of PHP and MySQL/MariaDB, to make sure they will support OpenEMR 7.0.0, and verify that the settings in php.ini correspond to the recommended values for OpenEMR 7.0.0
Depending on how comfortable you are with running SQL commands and doing various CLI operations in Linux, these are the next steps to take:

  1. Confirm that you haven’t entered any patient information in your new 7 installation, if you have, that’s going to be a problem. You originally said you were still using V5, so we will proceed assuming that nothing in your newly created 7 install needs to be retained.

  2. Drop the empty database that was created by running the setup process on your version 7 installation.

  3. Backup your V5 database, restore it on your V7 host. Looking at the contents of your existing sqlconf.php file, re-create those SQL credentials on your V7 host. Depending on whether you have chosen to use MariaDB 10 or MySQL 8, exactly how to do that will differ slightly. I personally am done with MySQL8, every OpenEMR environment that I build or upgrade from now on will have a MariaDB back end, as MySQL8 adds significant layers of time and complexity to all database administration tasks.

  4. I would start with a fresh copy of 7.0.0, so that you’re beginning with the correct default contents of the documents directory. Copy the contents of your existing …/sites/default/documents from 5 into your 7 environment, overwriting directory contents where required, but don’t remove any of the new sub-directories that are part of 7.

  5. In your 7 environment, edit the sqlconf.php file to include the correct database name and username/password credentials, make sure to change the config flag toward the bottom of the file so it reads “$config = 1”, so that OpenEMR doesn’t treat it as a new installation rather than an upgrade.

  6. Run the sql_upgrade.php routine in version 7 to update the version 5 database to version 7, then try to log in and see if it all worked.

Note that if you have customized forms, add on modules, or anything like that in your existing 5, making them work in 7 will require additional steps. Likewise for any 3rd party connections, data interfaces, HL7 links, etc. If you are e-prescribing, pay special attention to making sure your eRX system credentials are correct after the 5 → 7 upgrade, sometimes those parameters get changed or blanked during the update process. Usually that only happens in the 4->5 upgrade, but it’s always better to double check things like that.

You are wise to maintain your working 5 system separately rather than trying to make the jump from 5 to 7 in place in the same environment. There is a reason why a monkey never lets go of one branch before he has a firm grip on another…

Someone with more experience than I on 7 will probably have even better advice to offer, but hopefully this helps you get started again.


Thanks very much for the time to write this out. I will switch to MariaDB and follow this. I did try to upgrade again today and I replaced the 7.0.0 document folder with the 5.0.0 folder and then copied the 7.0.0 new files into the “old” documents folder. I suppose it has the same effect.

for 5.0.0 to 7.0.0 you can recursive copy to move from the old to the new webroot since in 7.0.0 the edi, era and letter_templates directories are under documents now

cp -r openemr-backup/sites/default/documents sites/default/
cp -r openemr-backup/sites/default/edi sites/default/documents/
cp -r openemr-backup/sites/default/era sites/default/documents/
cp -r openemr-backup/sites/default/letter_templates sites/default/documents/

When you say “drop the empty database”, which folder or process are you referring to?

Can anyone explain how to drop the empty mariadb database from 7.0.0 and restore the 5.0.0 database? I assume this is done in mysql? does this involve the openemr.sql file?

There are multiple ways to back up the sites directory. This is one method:

% sudo cd /path/openemr/sites
% sudo tar czvf /path/20221221_openemr-sites.tgz .

Dump your database:

% sudo mysqldump -u root -p openemr_default > /path/20221221-openemr_default.sql

Once those are safe, I would do upgrades in order to upgrade your database correctly, no?
I don’t know if you can just unpack a version 5 database into a version 7 installation.

To import your openemr SQL file into the database:
mysql -u root -p openemr_default < /path/openemr.sql

thank you. Do you have a suggestion for uploading my openemr 5.0.0 database (openemr.sql) into mariadb? I cannot seem to find the correct command to do this.

mysql -u root -p openemr_default < /path/openemr.sql