I am working on an e-commerce application in PHP. To keep URL\'s secure, product download links are kept behind PHP. There is a file, say downloa
readfile does not take up a large amount of memory. It opens the file, reads a small portion, writes that portion to the browser and then reuses the memory for the next read. It's the same as using fread+echo in a while loop. You will not be constrained by memory-limits, but you will be limited by max_execution_time and such.
If you want to use X-Accel-Redirect support (or similar) provided by your web server, send a header like this (for Nginx):
header('X-Accel-Redirect: /path/to/file');
Your application cannot know if the server supports this. You will need to provide a configuration option so the admin/installer of your software can provide such information manually.