Do you use or administer OpenEMR? Take the General Satisfaction Survey to help improve the product

Can't make a backup

Dumping OpenEMR database…
There was an error on the backup

Hi @mohamed

Can you provide a bit more information about the error you’re seeing?

What does the error say?
Can you show a screenshot?
What version of OpenEMR are you running?
What is your operating system?

Were you backing up the database using the built-in tools by navigating to:
Administration -> System -> backup

And selecting create backup?

1 Like

HI @RachelEllison
Thanks for your reply

-The error says: Dumping OpenEMR database…
There was an error on the backup
-openemr v 6.0
-Windows 10 and latest xampp version (clean install)
-Yes trying to create a backup generates the error immediately. Also i want to import a configuration file from another openemr instance on another machine to retain my configurations.

Hi @mohamed

Patch 1 for 6.0 was released ~2 weeks ago. It fixed a few things but I don’t recall if any had to do with backing up the database.

https://www.open-emr.org/wiki/index.php/OpenEMR_Patches

If you look in the xampp log files after attempting a backup do you see any additional errors/information?

1 Like

PHP Fatal error: Uncaught TypeError: mysqli_query(): Argument #1 ($mysql) must be of type mysqli, bool given in D:\xampp\htdocs\openemr\vendor\adodb\adodb-php\drivers\adodb-mysqli.inc.php:788\nStack trace:\n#0 D:\xampp\htdocs\openemr\vendor\adodb\adodb-php\drivers\adodb-mysqli.inc.php(788): mysqli_query(false, 'SET NAMES ‘utf8…’, 0)\n#1 D:\xampp\htdocs\openemr\vendor\adodb\adodb-php\adodb.inc.php(1263): ADODB_mysqli->_query('SET NAMES ‘utf8…’, false)\n#2 D:\xampp\htdocs\openemr\vendor\adodb\adodb-php\adodb.inc.php(1241): ADOConnection->_Execute('SET NAMES ‘utf8…’, false)\n#3 D:\xampp\htdocs\openemr\library\ADODB_mysqli_log.php(60): ADOConnection->Execute('SET NAMES ‘utf8…’, false)\n#4 D:\xampp\htdocs\openemr\library\sql.inc(58): ADODB_mysqli_log->ExecuteNoLog('SET NAMES ‘utf8…’)\n#5 D:\xampp\htdocs\openemr\interface\globals.php(268): require_once(‘D:\\xampp\\htdocs…’)\n#6 D:\xampp\htdocs\openemr\interface\login\login.php(28): require_once(‘D:\\xampp\\htdocs…’)\n#7 {main}\n thrown in D:\xampp\htdocs\openemr\vendor\adodb\adodb-php\drivers\adodb-mysqli.inc.php on line 788

Looking on stack overflow this issue can be caused by not using backticks when declaring a column name or trying to use a reserved word as a column name.

But I’d guess the most likely cause is probably from switching to PHP7.

Several features were removed, I think for security reasons, and code that was written in an earlier version of php no longer works when run in a php7 environment.

It looks like the statement causing the error is in the file D:\xampp\htdocs\openemr\vendor\adodb\adodb-php\drivers\adodb-mysqli.inc.php probably on line 788.

If it’s in the vendor folder is this from something extra that doesn’t come with a base/default OpenEMR install? It may be worth checking the vendor’s website to see if they updated their code/drivers to be compatible with php7.

1 Like

not to sound dump but i guess my php version is 8

Looking on apache friends it seems that the most recent version of xampp is running PHP 7.3.27 so if you’re using the most recent version of xampp that should be what PHP version you have.
https://www.apachefriends.org/download.html

The file that it is referencing in the error log isn’t written by OpenEMR. It’s written/managed by ADOdb.

I looked at the file the error log references on their github page. It was updated 21 days ago and line 788 that was throwing an error in the version you have is just a parenthesis, meaning what you have likely isn’t the current version of that file.

So if you have an old version of the driver/ADOdb project written before PHP7 was released and a version of PHP7 running in xampp the project may have individual lines of code that aren’t compatible with PHP 7(because they removed some capabilities for security reasons).

The project seems active so I’d guess they’ve probably fixed it so it works on PHP7 now. The project readme doesn’t specify an update procedure but they do talk about how to install it. So a good next step would be to figure out how to update your ADOdb code with a version compatible with PHP7.

Web server
Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.0.3
Database client version: libmysql - mysqlnd 8.0.3
PHP extension: mysqli Documentation curl Documentation mbstring Documentation
PHP version: 8.0.3

XAMPP
Initial release September 4, 2002
Stable release 8.0.3 / March 13, 2021
Repository sourceforge.net/projects/xampp
Operating system Windows Server 2008 and later Windows Vista and later Mac OS X 10.6 and later CentOS, Ubuntu, Fedora, Gentoo, Arch, SUSE

i have no idead what is this lol

Hi Mohamed,

Thank you for the link. I was looking at an old version of xampp. If it’s running PHP 8 it should still have the issue caused by PHP7 removing some capabilities.

I thought maybe ADOdb was something you might have installed as part of some custom code but it turns out it’s actually already included by default. In the composer file it specifies that it should get version 5.20.18 specifically.

I’m not sure if this was the latest version when it was added to the composer file or if there’s a particular reason it needs to be that exact version.

Looking on their website 5.21.0 is the latest version available.
https://adodb.org/dokuwiki/doku.php

According to their PHP compatibility status webpage
https://adodb.org/dokuwiki/doku.php?id=v5:php_compatibility_status
" PHP 8

PHP 8 has been released on 26-Nov-2020, and is fully supported in ADOdb 5.20.20 and later.

See the list of reported compatibility issues.

PHP 7

PHP 7 is fully supported since ADOdb 5.20.12 release.

All the reported issues have been fixed."

5.20.18 should be compatible with PHP 7. However it looks as though PHP 8 is only supported in versions 5.20.20 and later.

It looks like in order to have ADOdb, which seems needed for this functionality, to be able to work in PHP 8 you need a newer version. 5.20.20, 5.20.21 or a future version.

i guess i will uninstall xampp and then reinstall a fresh v 7.3 and then bring my back up in and see how it works !

It’s theoretically possible that updating changing the line in composer.json from:
“adodb/adodb-php”: “5.20.18”,

to

    "adodb/adodb-php": "5.20.21",

before installing openEMR in a PHP8 environment might just magically fix it without breaking anything else.

I started a ticket about this issue and will discuss it on the upcoming Saturday developer call.

a small update on my side. i removed xampp v.8 and installed v 7.4 and still couldn’t use my backup to get openemr up and runing. i guess i will have to go back to v 7.3 to see if it will work. The back up iam using was generated in openemr v6 on xampp 7.3 win 10 using the built in back up utility in openemr, and the update size is only 300 mb. This working configuration is still up and runing and i ama afraid the backups i am saving is not to going to bring me up if i crash !

installed xampp 7.3 and tried to restore backup and didn’t work as well. Now i installed a fresh openemr instance and created a new database and all and is up and running how do i restore from the backup.

By the way this new instance gives only the option to “Create and download a full backup” and “Create Eventlog Backup”, while the other openemr instance i have working has the option to export a configuration file as well.

Hi Mohamed,

I use docker so I don’t know too much about the xampp issues you’re seeing.

Here’s the instructions on the wiki for restoring from a backup, not sure when they were updated last though.
https://www.open-emr.org/wiki/index.php/Backing_Up_Using_the_Built_In_Tools#Using_the_Terminal

When new versions of openEMR are released there are sometimes changes to the database. E.g how tables are structured. So if you have a backup of a database made using a certain version of OpenEMR then try to load it into a different version of openEMR, it may complain.

I think there’s a way to convert it from one version to another, but I’ve never done it.

1 Like

Hi @Rachel_Ellison
i used to follow https://www.open-emr.org/wiki/index.php/Windows_OpenEMR_Restore_using_emr_backup.tar
And didn’t work for me. Will try your provided link and see how it goes.
And for compatibilities sake i installed the same version of xampp as the one used when creating the backup.