PHP realizes the back-end compression and packaging download of a large amount of data.

encountered a need to package and download pictures. The size of the picture should be about x10 to the fifth power, and the overall volume should be in the number of GB.. If you directly compress it and then return an address for the client to download, there will be a long operation gap in the middle, and there is no guarantee that the user will close the connection during this blank period. Therefore, consider using the scheme of one-time compression and one-time download (streaming download). Although the function of displaying progress is sacrificed, at least there will not be a blank period for a long time.

similar features such as phpmyadmin export (this is not compressed, I have been able to implement the packaging and download of), GitHub"s warehouse (make sure there is compression, considering that he does not know the final volume at the time of download, so consider to achieve streaming compression download)

some relevant materials have been searched on the Internet, but most of them are compressed first and then downloaded, which is estimated to be impossible to use under a large amount of data.

I would like to ask if any boss has done a similar function, can you explain the algorithm or provide a few keywords for me to search.

currently used keywords: php zip streaming download compression

Apr.25,2021

has been resolved, using a class called ZipFile that is pulled out of PHPmyadmin.


there is a question. Do you download it with a lot of people? Or just a few people?
in the case of many people, there will be a problem with your method:
each user downloading will take up a process, how many users do you download at the same time? How many processes have you opened for PHP-fpm? If the process is full, everyone else can only wait

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5fb88-4450b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5fb88-4450b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?