Skip to content
Advertisement

what i can do with error : permission denied in hosting service

i registered in one of the free hosting service i have a problem with extracting files , in panel of host i haven’t facility for extract files so i just write a script in php to do this , but i got this error : permission denied ! so in your idea can i do anything (like changing permission) or it should do with Linux administrator ??? (i can just do chmode to change the access permission on files and folders)

<?php
$zip = new ZipArchive;
if ($zip->open('main.zip') === TRUE) {
    $zip->extractTo('/myzip/');
    $zip->close();
    echo 'ok';
} else {
    echo 'failed';
}
?>

Advertisement

Answer

The code line $zip->extractTo('/myzip/'); implies you are extracting against root directory of the file system or your assigned chroot. You might not have permissions to do so – try this instead:

$zip->extractTo('./myzip/');
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement