Re: [PHP] Persistent flag in memory

[email protected] (Jochem Maas)
Newsgroups php.general
Message-ID <[email protected]>
Op 2/11/10 4:37 AM, Teus Benschop schreef:
> Good day,
> 
> May I ask you, gurus, whether it is possible to set a flag in PHP that
> persists for the duration of the server being switched on?
> 
> If the server would be power cycled, the flag would be off. Similarly if
> the web server would be restarted the flag would be off also.
> 
> I do realize that such a thing would be possible to be done in MySQL by
> using a table with flags in memory: CREATE TABLE IF NOT EXISTS timer
> (flag int) ENGINE = MEMORY;
> 
> But is this also possible in PHP?

take a look at memcache, or APC in terms of memory storage, although it might be possible
to have the web server setup a $_ENV value (I do this myself sometimes with the
mod_rewrite extension of apache).

as such php is a 'share nothing' architecture - so essentially there is no concept of
server level global/persisent vars. if your coming from .NET or Java et al this may be a
little shocking but it is by design, it requires a somewhat different approach (possibly)
to application design.

> 
> Thanks for any help,
> 
> Teus Benschop
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.