Backup your database (easy)

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
AppGini Super Hero
AppGini Super Hero
Posts: 369
Joined: 2019-05-21 22:42

Backup your database (easy)

Post by onoehring » 2019-11-30 09:32


I had the urge to backup the database as there are many, many changes in one day and it would be catastrophic to loose even one day.
After searching the net I found a nice, easy to implement script to backup a database:
  • Open the script in a browser and the database will be backed up.
  • The backup will be created in a user defined directory
  • with a unique name (databasename and timestamp) and
  • if the user likes it will be gzipped.
My additions changed the script to
  • make it possible to password protect it and
  • take database credentials directly from your AggGini application, so that it's easy to transfer to some other site.
(no magic done here by me).
The only thing one has to do is call that script - which - of course can be done by hand or using a cron job.
If you do not have a cronjob availabe you could use websites that offer such services ( or or ... does anyone else know free web cron services? Please add them in the thread for all of us to learn about them).

Source of the script: ... databases/ and the download page

How to use in AppGini?
Download the attached ZIP and extract it to your hooks folder. It will create a new subdirectory dbbackup. In this you will find a myphp-backup.php and another subdirectory sql_backup. In that sql_backup the backupfiles will be placed. The backups (hooks\dbbackup\sql_backup) can not be accessed through the browser as I protected the folder with a .htaccess file from any access.

You can call your database backup now and the backup will be created.

Additional safety
If you want to set an access password (recommended), open the myphp-backup.php file. Search for (around line 18)

Code: Select all

$run_pass ='';
Change this to the access code you like. Example:

Code: Select all

$run_pass ='mySecret';
You can call your database backup now and the backup will be created. If the password is wrong, you will get a specific message.

(4.67 KiB) Downloaded 4 times
Comments? Suggestions? Please post them here.


Post Reply