View Full Version : how to create and download the zip file(s) in php?
09-17-2009, 11:58 AM
Hello every one!
Can you please help me.. how to create and download the zip file(s) online in php?
09-17-2009, 12:10 PM
I think you could try one of the PHP functions like exec() (http://php.net/exec()), system() (http://php.net/system()), shell_exec() (http://php.net/shell_exec) to execute a command via shell and zip a file. Under Linux it would be something like this:
zip archive_name.zip filename_to_zip
Wildcard could be used in place of filename_to_zip.
If you have SSH access, you could run under Linux:
to see the reference on the zip command (provided your hoster allowed "man" via SSH - some hosting companies do not)
If shell commands are not allowed by your hosting company for security reasons, you would need to look for a 3rd party solution (probably written in PHP script which allows zipping).
09-17-2009, 01:19 PM
Modern versions of PHP include the ZIP library class (http://us.php.net/manual/en/book.zip.php) which makes it very easy to manipulate ZIP files.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.