Journal
Infrastructure

From XAMPP to Ubuntu: Migrating a Corrupted EMR to Linux

MariaDB system tables corrupted on the Windows host. The SQL dump was intact. The decision to stop repairing and start over turned a crisis into a clean foundation.

Terminal window showing Ubuntu server setup commands

What Broke

The original OpenEMR instance ran on a Windows laptop via XAMPP. After repeated issues, the MariaDB/Aria system tables corrupted. The database would not start. The storage engine returned checksum errors; the privilege tables were inaccessible.

At that point the choice was: repair or migrate. The Windows MariaDB system database was untrustworthy. Even a successful repair would leave questions about what else had corrupted silently.

The Migration

The application data was intact — a SQL dump from before the corruption, valid MariaDB header, proper CREATE TABLE statements. That dump became the migration artifact.

The new target: Ubuntu 22.04 LTS on a VirtualBox VM. Ubuntu 22.04 specifically, because it has better-tested compatibility with OpenEMR packages than newer releases. The stack: Apache, MariaDB, PHP 8.1, OpenEMR 7.0.

The dump imported cleanly. The application came up. The configuration work that followed — station accounts, demographics customization, form strategy — ran on a stable, known baseline.

Why This Matters

This was not a glamorous decision. It was the right one. The Windows repair path would have taken longer and produced less confidence in the result. The Ubuntu path cost some initial setup time and delivered a system that was: version-controlled, snapshotted, SSH-accessible, and running on an OS with a real package manager.

The instinct to "just fix what's broken" is understandable. The outcome of stopping that instinct early was a more reliable system going into the first field deployment.