Skip to content

Php tool to create backups of your website: MySQL Database, Folders and Files.

Notifications You must be signed in to change notification settings

gtntdev/php-backup-manager

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 

Repository files navigation

sPBM - Simple PHP Backup Manager

This is a free and open source PHP tool to create Backups of your website (MySQL Database, Folders and Files). The backups are saved in ZIP archives on server. The sPBM script can also restore the MySQL tables in your database from the SQL backup stored in ZIP archive.

Features

- Simple and easy to use interface to Backup MySQL tables and website directories.
- You can select the MySQL tables which to backup.
- You can backup the whole website, or the folders and files you wish.
- Ability to exclude files from backup (by their extension).
- Automatic backups of folders and MySQL database (by a small PHP script which must be accessed from Cron Jobs).
- Supports both PDO and MySQLi for accessing MySQL databases in PHP.
- Ability to restore the backup of the MySQL tables.
- You can Download, and Delete the ZIP archives with backups from server.
- The script can be easily translated and used in other languages, without affecting the code.

Requirements

- PHP 5.4+
- Modern Browser with JavaScript enabled (Mozilla-Firefox, Google-Chrome, Opera, Internet-Explorer 9+).

Installation

  1. Open the config.php file (in the "spbm/php/" folder) and add your Name and Password for Admin (to the $admin_name and $admin_pass variables).
  2. If you want to change the Root directory of the folders and files which can be selected for backup, change the value of the "ROOT_DIR" constant with the path of the directory you want for Root (RELATIVE TO THE ROOT OF YOUR WEBSITE ON SERVER, starting with "/").
  3. Copy the "spbm" folder on your server (with all its content).
  4. Set CHMOD 0755 (or 0777) permissions to the "spbm/backup/" folder on your server (it is used to store the ZIP files with the backups).
  5. Access the "spbm/index.php" file in your browser, with the address from server; for example: http://localhost/spbm/index.php
  6. Add your Admin name and password to loggin.
  7. To backup the MySQL tables, click on the "Connect to a Database" tab, and add your data for connecting to MySQL database (MySQL server, Username, Password, Database_Name). Then select the tables you want to backup.
  8. To backup the website folders and files, click on the "Backup Directories /Files" tab, and select the folders and files you want to backup (use the buttons from the top-right side).
  9. To Restore, Download or Delete archive with backup, click on the "Show saved ZIP files" tab.

Settings for Cron

If you want to automatically backup MySQL database and directories, access the "pbm_cron.php" file with Cron Jobs (from hosting CPanel), passing the "cron=ADMIN_NAME" for $_GET variable (ADMIN_NAME is the name added to the $admin_name variable).
For example, you can use one of these commands in Cron Jobs:
curl http://WEBSITE_NAME/spbm/pbm_cron.php?cron=ADMIN_NAME > /dev/null
OR:
lynx -source http://WEBSITE_NAME/spbm/pbm_cron.php?cron=ADMIN_NAME > /dev/null
OR:
/usr/local/bin/php /home/CPanelUSER/public_html/spmb/pbm_cron.php ADMIN_NAME > /dev/null
• Edit these settings in "config.php":
- In the $bk_cron_mysql array add your data for connecting to database.
- In the $bk_cron_dirs array you can add the folders you want to backup, located in the ROOT_DIR (To backup all the folders and files of ROOT_DIR, let the value as it is: ['']).
Example:
$bk_cron_dirs = ['dir1', 'dir2', 'dir3'];
- In the $bk_exc array you can add the extensions of the files you want to exclude from backup.
Example:
$bk_exc = ['ext1', 'ext2', 'ext3'];
- If you Not want to backup mysql database, set 0 to the BK_CRON_SQL constant.
- If you Not want to backup directories, set 0 to the BK_CRON_DIR constant.

Other Specifications

• By default, the ZIP archive with the database backup is saved with this format: "mysql-DB_NAME-DATE@TIME.sql.zip", so, every backup of the same database is saved into a new Zip file. If you want to have a fixed name for the database backup, change the "new" value of the ZIP_SQL constant with "fix"; so, the ZIP file with the database backup will have this format: "mysql-DB_NAME.sql.zip" (In Cron the script uses "fix").

• The name of the ZIP archive with directories and files is saved with this format: "dir-ROOT_DIR.zip".

• If you want to save the ZIP files in other directory on your server, modify the value of the BK_DIR constant in the "config.php" file.

• If you want to use the script in other language, translate the texts from the lang_en.json file (in the "spbm/templ/" foder) and save it in other "lang_...json" file, with the indice of the language, for example for Chinese save the texts in the "lang_ch.json". The texts in the ".json" file must be stored in valid JSON format. Then, change the value of the LANG constant in the "config.php" file with the same indice.
define('LANG', 'ch');



• Home Page: http://coursesweb.net/php-mysql/simple-backup-manager


  • This script is Free, and Open Source. You can use, modify and publish it freely.
    With blessing, MarPlo - MarPlo.net / CoursesWeb.net

About

Php tool to create backups of your website: MySQL Database, Folders and Files.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 64.1%
  • JavaScript 18.9%
  • CSS 11.1%
  • HTML 5.8%
  • ApacheConf 0.1%