Re: Sessions memory allocation problem
| From: | adrian zaharia | Date: | Mon, 31 Jan 2005 11:34:29 +0000 |
| Subject: | Re: Sessions memory allocation problem | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-207752@lists.php.net to get a copy of this message | ||
Richard Lynch wrote:
> adrian zaharia wrote:
>> 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 :(
>
> This naive reader would suggest filing a bug report...
>
> At least, *I* don't think it should behave this way.
>
> http://bugs.php.net
>
See this:
http://bugs.php.net/bug.php?id=31763&edit=2
Is not a bug but they under some configurations they cache the output :(
Adrian