Backup Config

It is a good idea to take a backup of your configuration before making any changes as it will allow you to quickly recover from an error.  The configuration information can be found in /data/config.inc.php.  There are many ways to backup the file and here are a few siuggestions:

  1. Take a regular backup of your entire site.  Your control panel should provide a method to do this.  If your host uses cPanel it is easy to setup with a few clicks and receive an email once it's complete.  Indeed you can have it FTP the backup to a remote location for you.
  2. If you use an HTML editor such as Dreamweaver, GoLive or Frontpage highlight the file and take a copy.
  3. Use the code below and place the link in the personal notes area of your BCP
<html>
<body>
<?php

// take a backup of the config

$config = file_get_contents('config.inc.php');

$result = 'Search for empty file';

while($result != '') {
  $cnt += 1;
  $file = 'config.bak.'.$cnt.'.php';
  $result = file_get_contents($file);
}

file_put_contents($file,$config);

echo "config.inc.php has been copied to $file";



?>
</body>
</html>

Place the above in a file called /data/bakconfig.php you can then call it with http://yourdomain.com/data/bakconfig.php

NB.  Each time you call this file it creates a new copy in the format config.bak.x.php where x is a new number.  These files are small and will not take up much space however after many backups you may like to remove them to keep your site tidy.  It is important to leave the extension as PHP as this will stop site visitors from accessing sensitive information such as usernames and passwords.

Home Forum Client Area