Dual Upgrade of OpenEMR and XAMPP in Windows

From OpenEMR Project Wiki

Introduction

You have decided to upgrade the OpenEMR portion of the OpenEMR XAMPP package. XAMPP is a bit outdated, so the question arises as how best to upgrade both.

It would seem to be more efficient and less work to take the piecemeal approach, by upgrading one followed by the upgrade of the other. Although it may appear counter-intuitive that installing the newest OpenEMR XAMPP package and importing the old database would require less work and produce less errors; in reality, that is the case.

XAMPP does not lend itself to an easy upgrade. The newest package has XAMPP already configured, thereby lessening the chance of introducing errors into XAMPP. With the installation of the new package, XAMPP would have been upgraded, without any additional effort on the part of the user. The download time of the .zip file for OpenEMR alone is comparable to that for the package. If the old package had errors, this is a good time to get rid of them. At some future time, the user will need to transfer the application to a new device. It will be less nerve-racking the second time around.

If the user follows the instructions exactly and precisely, this project should go smoothly. To avoid Alopecia (from tearing one's hair out), remember that no freelancing is allowed.

Let's get started.

Saving Old Data

It is very important to save the package in event of a mishap. Folders to be imported should be copied at this stage for easy accessibility.

It is never redundant to remind the user to backup before any major change is undertaken. This method of backup is recommended for reasons given in the Wiki page. Save this copy to a flash drive, external hard drive or medium of choice, but not to C-drive. This will help to minimize confusion and errors.

Open up Windows Explorer, go to C-drive->xampp->htdocs->openemr->sites->default. Send the default folder to a medium of choice; again not to C-drive.

The old database will require copying. Many Windows users are likely to get a slight spasm of the Coronary Arteries at the thought of running a mysqldump in the command line. They would ask why not use phpMyAdmin with its familiar Graphical User Interface instead of what appears to be a black abyss. The former is a finicky creature with an increased chance of errors and problems. Command Prompt, the command line in Windows, is more accurate. So, take a deep breath and exhale.

1. You will need the MySQL rootpassword, found in C:\xampp\security\security\mysqlrootpassword.txt if you don't have it written down.

2. To locate Command Prompt, go to the Start Menu and type co into the Search bar. It is not necessary to type the balance of the two words. Next click Command Prompt.

2u5.png

3. Copy these two commands:

CD C:\
C:\xampp\mysql\bin\mysqldump -u root -prootpassword openemr > dumpfile.sql

4. Remember to insert the rootpassword, allowing no space after the p.

5. Paste the two commands into Command Prompt as shown in the image below and hit Enter.

2u7.png

The dumpfile should appear in the C-drive tree. It will take time to create this .sql file if you have a large database.


Deleting Old Data

The old xampp folder must be deleted before the new package can be installed. Apache and MySQL must be stopped before deletion can occur.

1. Go to xampp->xampp control and double click it.

WINDOWS BACKUP AND RESTORE MADE EASY, figure 8.png


2. Click the Stop buttons for both Apache & MySQL.

Xamppcontrol.png


3. Click the Quit button to get out of xampp control.

4.Right click on the xampp folder to delete it. This will take time to complete. The entire xampp folder should disappear from C-drive tree upon completion.

2u6.png

Installing New Package

Select the newest package from this page. After installation, a brand new xampp folder will appear in the C-drive tree.

If the user were upgrading only OpenEMR, he would install the new xampp\htdocs\openemr folder. Because the package had been installed, this becomes superfluous.


Importing Old Data

Because this exercise is a super-duper upgrade, the instructions in the Windows Upgrade Guide will be altered considerably.

1. Due to the prior steps, the user is not required to move the old xampp\htdocs\openemr folder to another drive nor to rename the new xampp\htdocs\openemr folder.

2. Old data must be moved back into the new openemr folder by copying these folders:

openemr/sites/default/documents
openemr/sites/default/edi
openemr/sites/default/era
openemr/sites/default/letter_templates

2u9.png


into the xampp\htdocs\openemr\sites\default folder. Say yes to Copy and Replace.
2u8.png


3. Import the old database via Command Prompt with the dumpfile in C-drive into the new database with these 2 commands:

CD C:\
C:\xampp\mysql\bin\mysql -u root -p openemr < dumpfile.sql


Again copy & paste commands as demonstrated earlier & hit Enter.
The new database does not have a rootpassword yet, hence there is nothing after the p. The new rootpassword will be set later.


4. The new database had been assigned login credentials at the time of the package installation. The old login credentials in xampp\htdocs\openemr\sites\default\sqlconf.php file should not be copied over that of the new. It would not be possible to upgrade the old database that was just imported because the upgrade instructions must be able to "talk" to the new database. Note that this set of credentials is distinct and separate from that for user, root.

5. If the $config variable in openemr/sites/default/sqlconf.php needs setting, follow the directions.

6. If other default files had been customized, e.g., statement.inc (Patient Statements), bring them in as well.

Upgrading Old Database

Point the browser to http://localhost/openemr/sql_upgrade.php and choose the old version of OpenEMR that is being upgraded in the drop down menu.

Setting Up New Package

1. Set the time zone as described here. Because Apache had not been started, there is no need to stop it before setting time zone.

2. Start both services.

3. At a minimum, set up the Security Console.

4. Secure OpenEMR.

5. Patch the package and follow other instructions of the Installation Guide if available.

6. Before login, check that the correct version had been installed.

2u2.png


This was indeed thirsty work! You have well earned that stein of beer and big slice of pizza. Cheers.gif