ID: 31763 Updated by: [EMAIL PROTECTED] Reported By: adyzah at hotmail dot com -Status: Open +Status: Feedback Bug Type: Apache related Operating System: Linux PHP Version: 4.3.10 New Comment:
Do you have session.use_trans_sid enabled? Previous Comments: ------------------------------------------------------------------------ [2005-01-30 12:10:31] adyzah at hotmail dot com Description: ------------ I am testing the following code that pushes a file to the browser (Linux + Apache 1.3 + PHP 4.3.10 but tested also under several other configs) !!!!!! Try it with a BIG test1.zip (e.g. 100M in size) Try it with wget http://server/test.php or a browser but the result is more accurate when using wget since in browsers could work if you already had a succesfull download of a smaller file. !!!!!! What i discovered is that if i keep the 2 session initialisation functions the script will work ONLY if the allocated memory in php.ini is greater than the size of the tested file. If i remove the session functions the script works fine even if the test1.zip file is very big (hundreds of Megs) Reproduce code: --------------- <?php session_save_path('/tmp'); session_start(); $sFileName = 'test1.zip'; $sFileDir = '/var/www/html/'; header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment;filename=\"" . $sFileName . "\""); header("Content-Length: " . filesize($sFileDir . $sFileName)); header('Pragma: cache'); header('Cache-Control: public, must-revalidate, max-age=0'); header('Connection: close'); header('Expires: ' . date('r', time()+60*60)); header('Last-Modified: ' . date('r', time())); $oFp = fopen($sFileDir . $sFileName, "rb"); $iReadBufferSize = 512; while (!feof($oFp)) { echo fread ($oFp, $iReadBufferSize); } fclose ($oFp); exit; ?> Expected result: ---------------- The file should dowload via a browser or via wget Actual result: -------------- tail from apache error_log: Allowed memory size of 12582912 bytes exhausted (tried to allocate 10240 bytes) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31763&edit=1