문제

I am using code for unzip a file on server, but its not working, I want to unzip the zip file myfolder.zip on server. Code which I am using is :

<?php error_reporting(E_ALL);
set_time_limit(0);
$zip = new ZipArchive;
$res = $zip->open('myfolder.zip');
if ($res === TRUE) {
  $zip->extractTo('./');
  $zip->close();
  echo 'done!';
} else {
echo 'not done!';
}
?>

Is there anything wrong ?

도움이 되었습니까?

해결책

You need to upgrade server php version, ZipArchive will not work with php 5.2.

다른 팁

Your code seems to be fine, however Even i had faced a similar issue, increasing the memory limit directive in my php.ini fixed the issue for me.

you could find memory_limit directive, increase it and restart your web server and try to execute your code.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top