Sessions memory allocation problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am testing the following code that pushes a file to the browser 
(Apache 1.3 + PHP 4.3.8 but tested also under several other configs)

Try it with a BIG test1.zip (e.g. 100M in size)

<?php
ignore_user_abort();
set_time_limit(0);

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;

?>

What i discovered is that if i keep the 2 session initialisation functions
the script will work ONLY if the allocated memory 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)

Is it something i do wrong? Or is a bug and i should report it?

I mention that I NEED the 2 functions so removing them is not THE solution.
Nor setting in php.ini a huge memory limit :(

Thank you,

Adrian Zaharia

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux