This is commonly caused when you do not close the session before you begin sending the file data. This is because the session cache file can only be opened by one PHP process at a time, therefore the download is effectively blocking all other PHP processes at session_start()
.
The solution is to call session_write_close()
to commit the session data to disk and close the file handle before you start outputting the file data.