I'd like to use so-called application variables. These are variables that transcend sessions--they're available throughout the application being served by my web server. (Forget for now that I may have two or more servers serving up my app; I'll deal with that later.)
For example, I might have some variables whose values should be available to all scripts. I don't want to create them each and every time I start a session (my sessions are usually one POST and one response). I'd like to be able to create them whenever they need to be (e.g., the first POST after the server has started). Something on the order of:
if (!IsSet($_APP['someData'])) {
$_APP['someData'] = $whatever;
$_APP['otherData'] = $moreWhatever;
// and so on
}
I can add elements to the $_SERVER array, but two things bother me about that: 1) I'm not sure that's 'allowed', and 2) more importantly, the element and data I add don't survive from POST to POST.
I could also store the app variables in the db, but I'm not sure I want to hit the db each and every session start.
Ideas? Thanks.