PHP can execute shell commands, which means it can compress selected files into a archive or zipped package:
exec('tar zcf files.tar.gz file1 file2 file3');
Or make a zip file:
exec('zip files.zip file1 file2 file3');
You can then use PHP to render and supply download of the zip file to your visitor.
3 thoughts on “PHP: Compress Files into Tar or Zip – Make A Zip File or Tar File with PHP”
Pingback: MySQL: How to backup ALL databases as root with mysqldump at once?
Pingback: Linux: How to open and extract an RAR zipped file or unrar the archive?
Pingback: PHP Security Checklist for Websites and Web Applications – Bottom Line for Every Good PHP Developer
Comments are closed.