0

I have a WordPress installation on a bad server that I want to migrate.

I tried to make a backup via some WordPress plugins, but it was taking forever, generating an enormous zip file.

I asked help from my host support but they haven't replied since.

Looking for a solution I found a www symlink inside the www folder, which is causing the backup to run recursively, re-backing up the entire site again and again, never completing.

I installed the two most known file manager plugins, but both could not delete this symlink, returning an error.

Knowing that I don't have a FTP access, how do I manage to get rid of this symlink?

Is there a plugin that can handle symlinks? Or any way to run a command line to delete this thing?

  • Get a new host. No one that deals with code doesn't have FTP access. – Nathan Powell Sep 28 '16 at 6:11
0

Do you have any access to the server? SSH access? If you can get to a command line on the server you could try one of these commands. Using sudo would try and run the command as an administrator, so you would need a password:

unlink /path/to/symlink

sudo unlink /path/to/symlink

rm /path/to/symlink

sudo rm /path/to/symlink
0

I made it, inserted this code in the functions.php file and it worked:

function remove_symlink() {
    $linkfile = 'www'; //symlink to delete
    $old = getcwd(); // Save the current directory
    chdir($_SERVER['DOCUMENT_ROOT']); //Location of the file to be deleted

    if(file_exists($linkfile)) {
        if(is_link($linkfile)) {
            unlink($linkfile);
        } else {
            exit("File exists but not symbolic link\n");
        }
    }
    chdir($old); // Restore the old working directory ;
}

remove_symlink();

Note that you need to change the current working directory (chdir) to the symlink directory you want to delete.

Thanks for the insights!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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