Date: 09/30/98
- Next message: kd <email protected>: "Re: [PHP3] dbm writes fail - again!"
- Previous message: Stig Bakken: "Re: [PHP3] Sybase & PHP3.0.4"
- Maybe in reply to: pnet <email protected>: "[PHP3] File Locking Question"
- Next in thread: Rasmus Lerdorf: "Re: [PHP3] File Locking Question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
I don't understand why you'd want to write to this session_id file from both
frames. I would say, that once such an id is created, it should just be read.
So, if you'd created the id in the page containing the frameset, you'd only need
+
read access to that file. But for that, you don't need file locking.
As far as I understand your question, you want to be able to pass a unique id to
+
each user accessing your pages, am I right?
If so, you could compose a unique id (PHP: uniq_id (not sure about the exact
name),PERL: some combination of time(), mypid and REMOTE_ADDRESS), and pass that
+
over to the client as a cookie or as a GET-parameter in the URL. But you
wouldn't need to save it to a file. Another alternative in PHP is to use PHPLIB.
+
For now, you need a database backend such as mySQL or PostgreSQL to use its
session features. Go to see http://phplib.shonline.de to see if it would fulfill
+
your needs.
B.T.W.: I think that fopen behaves comparable to the open command in PERL, which
+
as far as my experiences tell me, waits until the file is accessible again.
But I'm not sure about that!
Regards
Jens
Quoting pnet <email protected>:
> Suppose my CGI writes to a file which contains a session_id.
>
> Suppose the browser is trying to create a frameset by calling the cgi to
> generate frame1 and frame2 and sends both requests essentially
> simultaneously.
>
> Suppose the request for frame1 is handled first, and CGI has the session_id
> +
> file open for writing at the same time that the request for frame2 comes
> in.
> (Another example would be several simultaneous requests for the cgi by
> multiple users...)
>
> What is going to happen?
>
> Will PHP report an error "unable to open file..." or will linux suspend the
> +
> CGI and keep trying to execute fopen() for awhile before returning an
> error?
>
> Do I need to handle such possibilities in my PHP script with something like
> +:
> while( ! fopen($fp, "w") );
>
> Related question:
>
> What kind of a file lock is caused by different modes of fopen?
> I.e., does any mode lock the file against being opened in any mode?
>
> My script needs to first read the file, then increment the count before
> writing it back out. I need to be sure that process2 doesn't try to read
> from the file after process1 has read it, but before process1 can increment
> +
> it and write the new value back out to the file.
>
> I am running PHP as CGI, if that makes any difference.
>
> Thanks for your help.
>
> - tppt: Tom Paine, Perpetual Traveller; webmaster <email protected>
> ================================================================
> The USA has the highest incarceration rate in the world (1.6 m)
> Most of those in prison are there for victimless 'crimes' (63%)
> Since 1979, property seized without trial, has increased by 2500%
> In the 'War On Drugs', drugs do not die. People do.
>
>
>
> --
> PHP 3 Mailing List http://www.php.net/
> To unsubscribe send an empty message to php3-unsubscribe <email protected>
> To subscribe to the digest list: php3-digest-subscribe <email protected>
> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.
> +php3
>
>
>
-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe <email protected> To subscribe to the digest list: php3-digest-subscribe <email protected> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3
- Next message: kd <email protected>: "Re: [PHP3] dbm writes fail - again!"
- Previous message: Stig Bakken: "Re: [PHP3] Sybase & PHP3.0.4"
- Maybe in reply to: pnet <email protected>: "[PHP3] File Locking Question"
- Next in thread: Rasmus Lerdorf: "Re: [PHP3] File Locking Question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

