File download closing session in PHP

1

I have a PHP file download system with login and session expiration in 30 minutes, at first I thought it was some logic error, but the system user only unexpectedly logs off when downloading several files in a short time lapse. Already if user download in cadenced form, one file after another the same problem does not occur. By performing tests I realized that it only happens when they are files of larger sizes (over 40MB).

download.php

header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename="'.$novoNome.'"');
header('Content-Type: application/octet-stream');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($arquivoLocal));
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Expires: 0');
header('Connection: close');  

readfile($arquivoLocal);
exit;
?>
<script type="text/javascript"> 
window.close();
</script>

I have already made some changes below:

Upload_max_filesize  - 1500 M
Max_input_time  - 1000
Memory_limit    - 640M
Max_execution_time -  1800
Post_max_size - 2000 M

source: link

Has anyone ever had this problem? Do you know of any configuration to solve this problem or some solution to this problem?

NOTE: I have access to the server and can make changes to apache and php.ini

    
asked by anonymous 05.10.2016 / 15:28

0 answers