Re: [PHP] Sessions memory allocation problem

2005-01-31 Thread adrian zaharia
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)
>>
>> > 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

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



[PHP] Sessions memory allocation problem

2005-01-29 Thread adrian zaharia
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)



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



RE: [PHP] Re: Browsing while downloading?

2004-12-02 Thread adrian zaharia
Hi,

Check the main thread, i have found the problem if you're interested...

Adrian Zaharia

Trevor Gryffyn wrote:

> Yeah, this isn't a PHP specific problem, BUT, in the off chance that PHP
> could solve the problem (using a different method of sending to the
> browser, etc) then it becomes PHP relevant... So everyone give the guy a
> break on the relevance issue.   If there were two ways of doing
> something and you only know one, wouldn't you want to ask if there was a
> second, better way, that didn't cause the problem you were having?
> 
> 
> Anyway..  Yeah, this might not be avoidable, although when you click on
> a link to download a file you can usually still continue browsing, so
> I'm guessing that there IS another way to do this.
> 
> Couple of thoughts:
> 
> 1. Have you tried smaller files just as a test (something that takes
> like 30 to 60 seconds to download maybe) just to see if you still have
> the problem?
> 
> 2. Is it feasible to create the file and provide a "click here to
> download" or "right-click and select SAVE AS.. to download"?  This might
> force the browser to handle it more like a standard download and not
> handle it as if it were loading a web page.
> 
> 3. Speaking of loading as a web page, are you getting a download
> progress bar or does the browser just keep spinning with it's normal
> "I'm loading a web page" progress bar?   If that was happening, it could
> be an issue of setting a good MIME type (what was it, like
> "octet/stream" or something that's a generic "this is a binary file"
> mime type?).   If your browser thinks its downloading HTML, that could
> lock it up.
> 
> 4. Lastly... I've noticed when my browser is locked up for whatever
> reason, that you can usually open another instance of the browser.
> Going to your desktop and double-clicking on the Internet Explorer icon
> again, etc.  This second copy of IE seems to operate in a different
> memory space... As a different program.  So if you crash or lock up the
> other instance, as long as you're not grinding your CPU or maxing out
> your memory, the second instance of IE or whatever should still work ok.
> I've had IE crash, with a "End Program" type propt and have other
> instances of IE be fine. But all the IE windows opened from the
> original window get nuked by the "End Program" function.
> 
> 
> Hope this helps at least a little.   I'm guessing there's a way to make
> it download without freezing your IE and I'm guessing it may have
> something to do with your headers and/or MIME type.   If that doesn't
> work, I'd investigate creating the file and letting the user click a
> link to download it, forcing the browser to handle it how it sees fit.
> 
> Good luck!
> 
> -TG
> 
>> -Original Message-
>> From: adrian zaharia [mailto:[EMAIL PROTECTED]
>> Sent: Wednesday, December 01, 2004 6:42 PM
>> To: [EMAIL PROTECTED]
>> Subject: [PHP] Re: Browsing while downloading?
>> 
>> 
>> Hi,
>> 
>> Thanks for reply, yet:
>> 
>> 1. i know has nothing to do with php but since now i am doing
>> it in php i
>> thought would be a good solution to post here
>> 
>> 2. bad browser? hmm... i tried: IE, Mozilla&Firefox (Win+Linux),
>> Opera(Win+Linux), Konqueror maybe there is still one
>> better out there
>> :P
>> 
>> Thanks,
>> 
>> Adrian

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



[PHP] Re: Browsing while downloading?

2004-12-02 Thread adrian zaharia
Found the problem...

Just FYI, maybe can help in future.

I am "under" a session and didn't forced a session_write_close() before i
outputted the stream. Acording to php docs, the session file stays locked
until the end of the script or a session_write_close() is issued. So, the
other scripts were in fact waiting for the session file to be unlocked.

Anmyway, ... interesting problem :)

Adrian Zaharia

M. Sokolewicz wrote:

> Adrian Zaharia wrote:
> 
>> Hello,
>> 
>> I have this problem and maybe smbdy can give me a hint.
>> 
>> I have a script which has to pack some server files into a tar created on
>> the fly and then output this archive to the browser via headers.
>> 
>> All is grea, the download works BUT, i am speaking of big archives, over
>> 50M and i noticed that while i am downloading i cannot browse anymore. I
>> tried the operation also via a opened window and it is the same. If i try
>> to click on the link or smth the browser does nothing. In the moment the
>> download finishes, the browser follows that clicked link and resumes it's
>> activity.
>> 
>> Any ideeas how can i keep browsing while dowloading?
>> 
>> Thanks
>> 
>> Adrian Zaharia
> get a different browser.
> This is a 100% browser issue where the browser allocated 100% available
> bandwidth for your download, and doesn't take in extra requests.
> 
> Notice, this has *nothing* whatsoever to do with php though :)

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



[PHP] Re: Browsing while downloading?

2004-12-01 Thread adrian zaharia
Hi,

Thanks for reply, yet:

1. i know has nothing to do with php but since now i am doing it in php i
thought would be a good solution to post here

2. bad browser? hmm... i tried: IE, Mozilla&Firefox (Win+Linux),
Opera(Win+Linux), Konqueror maybe there is still one better out there
:P

Thanks,

Adrian


M. Sokolewicz wrote:

> Adrian Zaharia wrote:
> 
>> Hello,
>> 
>> I have this problem and maybe smbdy can give me a hint.
>> 
>> I have a script which has to pack some server files into a tar created on
>> the fly and then output this archive to the browser via headers.
>> 
>> All is grea, the download works BUT, i am speaking of big archives, over
>> 50M and i noticed that while i am downloading i cannot browse anymore. I
>> tried the operation also via a opened window and it is the same. If i try
>> to click on the link or smth the browser does nothing. In the moment the
>> download finishes, the browser follows that clicked link and resumes it's
>> activity.
>> 
>> Any ideeas how can i keep browsing while dowloading?
>> 
>> Thanks
>> 
>> Adrian Zaharia
> get a different browser.
> This is a 100% browser issue where the browser allocated 100% available
> bandwidth for your download, and doesn't take in extra requests.
> 
> Notice, this has *nothing* whatsoever to do with php though :)

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



[PHP] Browsing while downloading?

2004-12-01 Thread adrian zaharia
Hello,

I have this problem and maybe smbdy can give me a hint.

I have a script which has to pack some server files into a tar created on
the fly and then output this archive to the browser via headers.

All is grea, the download works BUT, i am speaking of big archives, over 50M
and i noticed that while i am downloading i cannot browse anymore. I tried
the operation also via a opened window and it is the same. If i try to
click on the link or smth the browser does nothing. In the moment the
download finishes, the browser follows that clicked link and resumes it's
activity.

Any ideeas how can i keep browsing while dowloading?

Thanks

Adrian Zaharia

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



[PHP] Socket problem

2003-05-29 Thread Adrian Zaharia
Hi,

I try to make a script which runs 24/7 and which connects to a socket 
based news feed and fetches some data whenever the server sends it.

The problem is that if i disconnect the client machine from the network, 
the program is not making any difference between receiving nothing cause 
server sends nothing, and receiving nothing cause it has no network. 

Also, didn't found any way to set a timeout. 

A bigger problem is that when i start the network, the program simply hangs.

Can anybody give me a hint? I saw similar previous postings without any 
reply. Maybe i will be the lucky one.

Regards,

Adrian


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