Well, on unix, you could use the (still experimental, according to 
the docs) shared memory functions:

        http://php.he.net/manual/en/ref.shmop.php

There's also the apparently more mature, but less portable 
semaphore/shared memory functions (also Unix only) here:

        http://php.he.net/manual/en/ref.sem.php

I've never used either of these.

Maybe you could explain what you're trying to do a bit more (and what 
platform you're on). I can't see where loading separate copies of the 
variables would be much of a memory issue, unless you have large 
numbers of variables, very long strings stored there, and hundreds of 
apache child processes.

        - steve



At 2:52 PM -0400 4/11/02, [EMAIL PROTECTED] wrote:
>If I do that, won't the data that I fetch be duplicated in memory for each
>user?  I'm trying to have just one space in memory allocated for these
>variables, sort of like the HTTP_SERVER_VARS.  It seems that even if I do an
>autoprepend that file is going to run each time a user visits the site and a
>new memory space will be created for that variable.  What I'm asking is how
>to set those constant server-wide global variables.
>
>Thanks
>Roger
>
>-----Original Message-----
>From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, April 11, 2002 10:15 AM
>To: [EMAIL PROTECTED]
>Cc: [EMAIL PROTECTED]
>Subject: Re: [PHP] Set Global Variables
>
>
>Set up an auto_prepend file that either simply sets these constant globals
>ot fetches them from the DB.
>
>-Rasmus
>
>On Thu, 11 Apr 2002 [EMAIL PROTECTED] wrote:
>
>>  Is there a way to set a global variable that all users can access?  I have
>>  some values in a database that I'm reading at the beginning of the session
>>  and carrying through out the session.  The thing is, those values are the
>>  same for every user and instead of having a memory space for each users
>>  values I'd rather just use one memory space for all users.
>>
>>  Thanks
>>
>>  Roger Ramirez
>>  Web Developer
>  > LifeFiles.com Inc.
>>


-- 
+------------------------------------------------------------------------+
| Steve Edberg                                      [EMAIL PROTECTED] |
| University of California, Davis                          (530)754-9127 |
| Programming/Database/SysAdmin               http://pgfsun.ucdavis.edu/ |
+------------------------------------------------------------------------+
| "If only life would imitate toys."                                     |
|                  - Ted Raimi, March 2002                               |
|                  - http://www.whoosh.org/issue67/friends67a.html#raimi |
+------------------------------------------------------------------------+

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

Reply via email to