Asked 3 years ago
27 Mar 2021
Views 721
Mitul Dabhi

Mitul Dabhi posted

ZipArchive() not working on AWS EC2 with linux php

i am trying to use ZipArchive but application crash at this code , so is there anything i missing

 $zip = new ZipArchive;
if ($zip->open(getcwd() . '/today.zip', ZipArchive::CREATE) === TRUE) {
    $zip->addFile(getcwd() . '/filetest2.txt', 'filetest.txt');
    $zip->close();
    echo 'ok';
} else {
    echo 'failed';
}


i am using AWS EC2 LINUX
hanuman

hanuman
answered Nov 30 '-1 00:00

you need to install zip and php-zip at EC2 linux server
you can run following command

sudo apt install zip 


sudo apt install php-zip 


now restart apache server

  sudo service apache2 restart

Post Answer