Вопрос

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