tar 파일을 디렉토리에 압축을 풀려고하지만 어떻게 될지 모릅니다. tar 파일과 동일한 디렉토리로 추출 할 수 있지만 다른 폴더에는 추출 할 수 없습니다. (아무것도 추출되고 있지)tar 파일을 디렉토리로 압축 해제
$filename = "homedir.tar";
exec("tar xvf $filename");
는 다음를 시도했지만 작동하지 않습니다 :
exec("tar -C, homedir zxvf $filename");
업데이트 :
# Absolute paths
$filepath = "/home/acc/public_html/test/test/homedir.tar";
$folderpath = "/home/acc/public_html/test/test/homedir";
# Check if folder exist
if(!is_dir($folderpath)) {
die('Folder does not exist');
}
# Check if folder is writable
if(!is_writable($folderpath)) {
die('Folder is not writable');
}
# Check if file exist
if(!file_exists($filepath)) {
die('File does not exist');
}
exec("tar -C $folderpath -zxvf $filepath");
: 이것은 내 파일의 내용이
입니다
오류는 없지만 압축을 풀지 않습니다.
웹 서버에 pear tar가 설치되어 있습니까? – Mythli
두 번째 매개 변수로 빈 배열을 전달한 다음 해당 배열의 내용을 검사 해보십시오. 무엇이 잘못되었는지에 대한 단서를 줄 수있는 모든 출력을 보여줍니다. 참조하십시오 : http://us3.php.net/manual/en/function.exec.php – gregghz
나는 그것을 시도 빈 $ status = array(); exec ("tar -C $ folderpath -zxvf $ filepath", $ status); print_r ($ status); –