Making and Restoring Backups

Backing up your SocialEngine website is one of the most important steps that you can take to ensure the integrity and longevity of your SocialEngine website. Whether you're installing a new plugin or theme, upgrading to the latest version, or customizing SocialEngine's code, you should backup your website as often as possible.


This article will guide you through the process of making a backup of your site, however if you aren't familiar with the terms below, you should be cautious when performing the actions listed. Many hosting providers provide free (or inexpensive) backup systems that they can restore for you if necessary. We HIGHLY recommend that you start by consulting your web host to find out if they offer backup services.

Further, backing up a large database can get fairly complex, so if your site is very big, the instructions provided below may not be suitable for your specific needs. Large website owners are encouraged to contact their hosting provider or contact one of our integration partners to discuss backup strategies that would be more suitable for their website.

What is a backup?

The term backup refers to making copies of data as a sort-of insurance policy. In the event the original data is lost or damaged, you will be able to turn to your backups to restore the data.

What's the most important thing to backup?

SocialEngine is a robust database-driven application, and as you might have guessed, your database is the most important thing to backup. This is the "meat and potatoes" of SocialEngine, where your website's most valuable data resides.

Most hosting providers include some sort of database management tool within their control panel software which you can use to backup your a MySQL database and more often than not, the software that they include is a version of phpMyAdmin. If you are not sure how to access phpMyAdmin or are not sure if your host provides access to the software from their control panel software, please contact your hosting provider's support staff and request additional instructions.

If your hosting provider uses some other database management tool, or does not provide access to any MySQL database management tools, you can download a copy of the software from the phpMyAdmin website.

Before you can create a backup of your SocialEngine database, you will need to know the name of your SocialEngine database and perhaps the login credentials for the database. If you don't have this information memorized, or if it's provided through your host's control panel, you can easily retrieve it from the database configuration file that SocialEngine stores during the installation process.

Using a FTP client, connect your sever and navigate to the "/applications/settings/" directory within your SocialEngine installation. Download the file "database.php" and open it with a text editor. Within this file, you will see code very similar to the following PHP code:

<?php defined('_ENGINE') or die('Access Denied'); return array ( 
  'adapter' => 'mysqli',
  'params' =>  
  array (
    'host' => 'localhost',
    'username' => 'username_here',
    'password' => 'password_here',
    'dbname' => 'database_name',
    'charset' => 'UTF8',
    'adapterNamespace' => 'Zend_Db_Adapter',
  'isDefaultTableAdapter' => true,
  'tablePrefix' => 'engine4_',
  'tableAdapterClass' => 'Engine_Db_Table',
); ?>

The contents of your configuration file will be different, however the structure of it should be very similar. If you are not familiar with PHP, much of this will seem like a jumbled mess. The only information you really need to be concerned with are the lines of code in the file that resemble the following:

'host' => 'localhost', 
'username' => 'username_here',
'password' => 'password_here',
'dbname' => 'database_name',

If this were data from an actual SocialEngine database configuration file, these lines would indicate the connection information for the database is as follows:

MySQL database host: localhost 
MySQL databse username: username_here
MySQL database password: passwod_here
MySQL database name: database_name

Notice that the that the affixed single-quotes and commas are removed. Armed with this information, you are ready to connect to our MySQL database and create a backup.

Backup the Database

1. From main page of phpMyAdmin, locate and click on the "Export" menu item.
2. Once the page loads, locate the section of the page labeled "Export". Select the name of your SocialEngine database and below the database selection box, ensure that the radio button next to "SQL" is selected.
3. Next, locate the section labeled "Structure" with a checkbox next to it. Select this checkbox and the following options below it:




Enclose table and field names with backquotes
4. A little further down the page, you should notice the section labeled "Data" with a checkbox next to it. Select this checkbox and the following items below it:

Select the check box marked "Complete inserts".

Select the check box labeled "Use hexadecimal for binary fields".

Select "INSERT" in the combo box labeled "Export type:"
5. Further down the page, ensure that the checkbox next to "Save as file" is selected.
6. Finally, click on the "Go" button to begin the export and wait for the file to download.

Backing Up Your Files

The core SocialEngine application files will not change often, however before you install, upgrade or make any changes to SocialEngine's files, you should take a backup. The most important files to backup, are those that drive the application. These are the files that exist within the following directories within your SocialEngine root:


In addition to these directories, the following files within your SocialEngine root should be included in your backup:


All of SocialEngine's application files total less than 50Mb making FTP (File Transfer Protocol) a viable option for quick backups prior to performing an upgrade or plugin installation. You can simply download these files and directories to your computer using a FTP client and archive them as needed.

If you don't already have a FTP client, you can use Filezilla, which is a free cross-platform FTP application. You may download a version of Filezilla compatible with your operating system on the download section of their website. Instructions on how to use Filezilla are included within the documentation section of their website.

Restoring your Backup

If you encounter a situation when your site stops functioning due to a change, upgrade, or third-party mod installation, you'll need to restore the backup you took. Follow the instructions below to restore your site.

Restoring your Database
1. From main page of phpMyAdmin, locate and click on the "Import" menu item
2. Click on the file upload dialog and locate the exported file you wish to import (the file you downloaded in the previous section).
3. Locate the section titled "Format of imported file" and ensure that "SQL" is selected.
4. Click the "Go" button to submit begin importing.

Restoring your Files

To restore your files, use an FTP client (like Filezilla, mentioned before) to upload the files you backed up onto your server. Overwrite the files on your server with the backup files to restore your site.


Другие публикации по теме: