Dual Upgrade of OpenEMR and XAMPP in Windows
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\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.
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.
6. If you never set the mysql root password in the first place, just run the mysqldump with 1 space between p and openemr in the second command.
7. If you previously set the mysql root password, using another method besides the Security Console and you can't remember it; try resetting as explained here.
8. Another alternative for a lost mysql root password is to use the credentials from xampp\htdocs\openemr\sites\default\sqlconfig.php.
9. 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.
2. Click the Stop buttons for both Apache & MySQL.
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.
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
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
- into the xampp\htdocs\openemr\sites\default folder. Say yes to Copy and Replace.
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. It will be set later.
4. 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.
6. Before login, check that the correct version had been installed. If patched correctly, it should read v4.2.0 (x) where x is the patch number.