
Using readfile() loads the entire file into PHP memory. This causes crashes with large files. Use a chunked stream approach instead.
Your (Apache or Nginx) to leverage native file-acceleration extensions. download file code in php
Advanced Technique: Resumable Downloads (HTTP Range Support) Using readfile() loads the entire file into PHP memory