Zip & Download script without PHP's Zip extension

Hi,

I know that you can zip and download files/folders with PHP, I actually have a script that does this. The script uses ZipArchive class which requires PHP’s Zip extension to be installed/activated.

Is it possible to have a “zip & download” script which doesn’t require that extension?

Thanks for any ideas.

You may try the unzip UNIX command, and use it with exec or ``

No idea what that does but I am not trying to unzip, I am trying to zip and download.

I found another script that uses exec() function of PHP but it doesn’t work if safe mode is enabled. I may use that but I am still looking for alternative options.

My bad, I wanted to say zip but, with safe-mode enabled…

Without exec or passthru or “` operator”, I cannot see a solution - you need an external program to do the job.

So, you may try

exec("zip -r output/files.zip path/to/dir");

Do it with error_reporting(E_ALL) so you’ll know for sure if it works.