Re: Persistent flag in memory
| From: | Jochem Maas | Date: | Thu, 11 Feb 2010 04:54:24 +0000 |
| Subject: | Re: Persistent flag in memory | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-301976@lists.php.net to get a copy of this message | ||
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
>
>