However, this is not always an option working on client sites. Some do not have ssh enabled for various reasons, including hosting restrictions (e.g. shared hosting) or security concerns and workplace policies.
So, in these situations, it is hard to replicate the site on a test server for an assessment, development work, or moving the site from an old server to a new one.
The following are some techniques that I use when I need to copy a site quickly.
If the site in question has cPanel, you can use phpMyAdmin to backup the database, and either save it to a file, or directly download it to your desktop. That takes care of the database part, what about the files then?
For the files, you can use cPanel's cron interface to run a command like the following after 2 minutes from present time:
cd ~/public_html; tar -czvf BACKUP.tar.gz .
Wait for the two minutes to pass, then using FTP or cPanel's File Manager, download the archive that was created.
Using a temporary PHP script
Instead of using web based interfaces, which can be clumsy, you can use FTP to upload a custom PHP script that executes shell commands on your behalf.
First, download the settings.php file for the site. In it, there will be the database name, the use name and password for the site.
Second, take the above information and create a PHP file like this one. Replace the capitalized values with those you just gleaned from the settings file.
<?php exec("mysqldump -uDBUSER -pPASSWORD DBNAME > DBNAME.sql"); exec("tar -czvf BACKUP.tar.gz ."); print "Done";
Name the file something unique and unguessable, such as a timestamp or a random number (e.g. 74688266024.php). Make sure that it ends in .php.
Upload this file using FTP to the public_html directory for your site. Then point your browser to it (e.g. http://example.com/74688266024.php), and wait till the backup completes.
Now, delete the php file you just created, so no one else can run the script.
After that, download the tar achive using FTP, and delete it and the database dump too.
There are several Drupal modules that provide backup and restore facilities to varying degrees. One such module is backup, dba, and backup_migrate. You can use one of them to create the backup you need and then download it.
However, this requires extra steps like uploading the Drupal module, enabling it, configuring it, running the backup, then disabling/deleting the module.
What other tricks for copying/replicating a site do you use if you encounter a restrictive environment?