The Zend Download Server (ZDS) (Part of the Zend Platform product) takes over long running download processes from the apache/php running the actual web application. The download is then handled by a very lighweight process, saving resources. This is very similar to X-LIGHTTPD-send-file of lighty or its apache-port mod_xsendfile (while this only does half of the job). The advantage of ZDS is that it can also send strings and streams that do not nessecarily reside as files on any harddrive. It is as easy as calling:
zend_send_file(<filename>,<mimetype>,<headers>)
or
zend_send_buffer($phpVar,<mimetype>,<headers>).
Then, the PHP process is terminated and the content is delivered using the ZDS.
So much the theory. There are three issues to consider though:
- ZDS discards all headers that have been set by the PHP header() function in advance. If you want to send headers (like content-disposition of filename), you need to use the optional <headers> parameter.
- To determine the mime type of the file to be sent, ZDS uses its own mime-Type-Lookup-File. It does not use the apache mime.types.
- If sending a file, make sure that it resides on local file system since ZDS uses mmapping to access the file, which is quite inefficient (if not dangerous) on network mounts like NFS3.