"Jon Grieve" <jgrieve@southdown-co-uk> wrote in message
news:10dgcqcjrqte27@corp.supernews.com...[color=blue]
> Kevin Thorpe wrote:[color=green]
> > Jon Grieve wrote:
> >[color=darkred]
> >> Having come to PHP from another CGI, there's one thing I really miss...
> >>
> >> The previous tool used was Witango, which had one major difference:
> >> the interpreter ran as a service/daemon. One benefit of this was, you
> >> could have variables scoped at a number of different levels above the
> >> once-only variables in PHP (i.e. sessions).
> >>
> >> Specifically, it was possible to create variables at a system-wide and
> >> site-wide level. I could set a value and it would be available to any
> >> app run within that site -- a classic example would be a variable
> >> containing the title of the site.
> >>
> >> Can I replicate this functionality in PHP?
> >>
> >> I'd guess that the norm in PHP is to re-read this kind of information
> >> from a DB with *every* hit; a huge overhead.
> >>
> >> Can PHP be run in a more "persistant" manner?[/color]
> >
> >
> > You could write your own session handler. The default one simply
> > serialises $_SESSION and saves it in a plain file. I've seen a
> > discussion somewhere about using a session server instead. At this point
> > it would be relatively easy to maintain $_SESSION['global'] and
> > $_SESSION['local'] separately.
> >
> > It does beg the question though as to why you need site/application
> > global variables. Constants are easily supported using a config file.
> > I've never come across a requirement for global variables, only session
> > specific ones.[/color]
>
> A couple of examples would be...
>
> I have some dynamic site, where just about everything to do with layout
> and presentation is dynamic (title, width, colours, etc., etc.). From
> what I've seen so far, a common way to handle this would be to maybe
> include() a file that defines and initialises all these values. This
> might be from a DB or simply a static set of consts. So, every PHP app
> includes this massive overhead.[/color]
*massive* is a relative term. Many sites load static values from a config
file with every page, but it is usually up to the underlying file system to
hold this in cache memory so as to avoid a disk read each time. With modern
servers being so fast you should not notice any discernable delay.
--
Tony Marston
http://www.tonymarston.net