Re: Declaring SERVER-WIDE Variables

From: Date: Fri, 02 Mar 2001 02:59:39 +0000
Subject: Re: Declaring SERVER-WIDE Variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-42274@lists.php.net to get a copy of this message
Hi Michael, I've never used it myself, but this may be of some use: http://www.php.net/manual/en/ref.shmop.php If I understand it correctly, this lets you write a string into an area of memory which can be accessed from any process - i.e. another httpd process. If you wanted to save an array you would need to serialize() it first. Cheers Simon Garner From: "Michael David" <michaeld@miller-group.net> > Greetings, fellow PHP hackers! > > The current project I'm working on is porting software written in Tango to > PHP4. Because these programs heavily rely on information held in (off-site) > databases, the tango programs were written to have a set of array variables > declared from SQL queries, which then any user hitting the site would have > access to. > > Ie... > > User 1 hits the webapge.. the server realizes this is the first user and > populates the arrays with data from the source database. The page is able > to use these arrays. > > User 2 hits the webpage.. the server already has the arrays packed with > data, and user 2 is able to hit the pages quickly, due to no queries being > made. All users are this way. > > Some events would require that these arrays be re-hashed such as when a user > updates, inserts or changes the value of an item in the database. These > changes. > > When this update happens, the changes would be made to the server-wide > variables, so ANY user on the machine (independant of sessions) would have > the fresh data when it next pulls from the arrays. > > .... > > Ideally, this would be like settings HTTP_SERVER_VARS[school_array] to > contain the data, where every page would have $school_array there without > any additional work, and a refresh being a small function that creates the > arrays needed and sticks them into HTTP_SERVER_VARS[array_name]. (Along the > lines of PHP_SELF, but not dynamic in that sense.) > > Some of this could be handled with sessions, but my concern is that carrying > ALL of this data with each user is a waste of resources, and will require > more database calls than needed. > > If anyone has ANY ideas, PLEASE share them! :) > > Regards, > > Michael > > > --- > Michael David > The Miller Group > Web-based software for Schools > http://www.miller-group.net > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#42274) next »