How to copy/archive a site with only FTP access
Anyone who has used a FTP program will know how cumbersome it can be to download or upload individual files. To save some time, here's an excellent tip on copying/archiving a whole site with FTP access, thanks to Khalid.
All that is required is to place a PHP script on your server and run the script via web browser.
To do this, create a file called (something like saveme.php) and in this file type in:<?php
exec("mysqldump -uDBUSER -pPASSWORD DBNAME > DBNAME.sql");
exec("tar -czvf BACKUP.tar.gz .");
print "Done";
?>In the code snippet above:
- Replace the DBUSER with your own DB user name.
- Replace PASSWORD with your own DB password.
- Replace DBNAME with your own DB name
These should be the user and password that is used for the site. Next run the script in your browser and wait for it to complete
If backing up a Drupal site, these details can be found in your settings.php file. If backing up a Joomla site, these settings can be found in your configuration.php file. However, this script can be used on any site running PHP for creating a backup. Upload this to the site and run the script via web browser (for example: http://my_domain.com/saveme.php).
Go make yourself a cup of coffee or tea and wait. Once complete, this should create a backup zip file and a database sql file dump in your root directory of the site. Now just download both these files and once completed delete the saveme.php file. I feel it's better doing it this way than to download every single file because when there are many sub directories within a main directory it can take longer to download every file since the FTP always needs to fetch and execute.
Of course, even better is to use rsync.
Trackback URL for this post:
- ‹ previous
- 131 of 157
- next ›

Delicious
Digg
StumbleUpon
Reddit
Newsvine
Google
Technorati


Recent comments
6 days 16 hours ago
3 weeks 1 day ago
3 weeks 3 days ago
3 weeks 6 days ago
4 weeks 4 hours ago
4 weeks 2 days ago
4 weeks 2 days ago
4 weeks 3 days ago
4 weeks 4 days ago
5 weeks 1 day ago