Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently trying to download a full magneto install from a ftp server. The connection keeps failing, it seems as if there are too many files and folders to scan through?

Can anyone shed any light on how to resolve this? The shared platform seems to b e a standard platform based on Plesk 8.6.

As this is a shared server, there is no option for me to really do anything, apart from contact the hosting company (who have offered to zip up all the files for me, but this is not ideal)

share|improve this question

Do you have SSH access? You can either do a recursive SCP or perhaps pipe a tar/gzip stream over the secure pipe. That way you'll avoid the FTP timeouts.

share|improve this answer

If you've not got SSH access, then this should do you nicely,


Simple create a PHP script on the origin server and destination server as per the below and replace the initial variables as necessary.

To Backup

        $db_host = "";
        $db_name = "";
        $db_username = "";
        $db_password = "";
        // Backup database
        shell_exec("/usr/bin/mysqldump -h ".$db_host." -u ".$db_username." -p".$db_password." > ".$db_name.".sql &");
        // Backup entire site
        shell_exec("/usr/bin/tar cfz ".$_SERVER['HTTP_HOST'].".tar.gz
            ".$_SERVER['DOCUMENT_ROOT']." &");

To Restore

    $db_host = "";
    $db_name = "";
    $db_username = "";
    $db_password = "";
    // Only set these if you are changing your domain name
    $old_domain = "";
    $new_domain = "";
    // Restore entire site
    shell_exec("/usr/bin/tar xfz ".$_SERVER['HTTP_HOST'].".tar.gz
    if (!empty($old_domain) && !empty($new_domain)) {
        $sql = &file_get_contents($db_name.".sql");
        $sql = str_replace($old_domain,$new_domain,$sql)
    // Restore database
    shell_exec("/usr/bin/mysql -h ".$db_host." -u ".$db_username." -p".$db_password." < ".$db_name.".sql &");
    $xml = simplexml_load_file($_SERVER['DOCUMENT_ROOT']."app/etc/local.xml");
    $xml->global->resources->default_setup->connection->host = $db_host;
    $xml->global->resources->default_setup->connection->dbname = $db_name;
    $xml->global->resources->default_setup->connection->username = $db_username;
    $xml->global->resources->default_setup->connection->password = $db_password;
    // Disable cache
share|improve this answer
Same again - links only answers are no good – Iain Jun 22 '12 at 8:10
I'm on a mobile phone, so formatting full answers is a bit on the tricky side. I've done my best to include sufficient information above, ignoring the weak formatting. – Ben Lessani - Sonassi Jun 22 '12 at 8:20
:) backticks don't format well over multiple lines. – Iain Jun 22 '12 at 8:25
I'm aware, but I'm on a mobile phone, reformat the post if its bothering you. – Ben Lessani - Sonassi Jun 22 '12 at 9:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.