Re: Application Scope variables ?

From: Tony Marston (tony_at_NOSPAM.demon.co.uk)
Date: 09/23/04


Date: Thu, 23 Sep 2004 18:49:53 +0100


"aa" <aa@virgin.net> wrote in message
news:4152a0a2$0$17948$ed2619ec@ptn-nntp-reader02.plus.net...
> In ASP an application is an object created when a first request is made to
> a
> website. This object seats in the memory and contains methods and
> properties
> some of the properties can be created and modified from ASP code.
> As a websever can serve more them one website and some websites might be
> visited just several times a day, there is little point to keep all these
> website objects in the memory all the time. For that purpose, if a website
> does not receive requests for certain time (which can be preset on the
> websrver), the Application object is destroyed and memory reclaimed. Not
> to
> loose data stored in the Object, it allows to write this data onto disk
> before being destroyed.
> If I understand correctly, PHP does not maintain such an object and the
> variables relevant to the whole website need to be written onto disk
> before
> a relevant session expires.

Correct. PHP does not understand the concept of "application" as you
describe it.

>From your description it seems to be more of a function of the web server as
only the web server can create the object on the first request, and destroy
the object if there have not been any requests for a period of time.

If you want to emulate this with PHP you must read in the variables with
every request and write out any changes before the script dies. You can use
session files or database tables. It may be possible to use data in shared
memory, but you would have to write your own routines for loading it and
destroying it. Personally I wouldn't bother as the overhead of reading in
data with every request is so small that it's not worth the effort to
replace it with something more flashy.

-- 
Tony Marston
http://www.tonymarston.net


Relevant Pages

  • Re: Application Scope variables ?
    ... > In ASP an application is an object created when a first request is made to ... > As a websever can serve more them one website and some websites might be ... > website objects in the memory all the time. ... only the web server can create the object on the first request, and destroy ...
    (alt.php)
  • Re: Nokia Product Security Contact?
    ... or you can visit their website: ... and request to be contacted. ... > Does anyone have any Nokia product security contacts please? ... "Netscape is an application which grows to fill all available memory." ...
    (Bugtraq)
  • [PATCH 0/3] ia64: Migrate data off physical pages with correctable errors v3
    ... Migrate data off physical pages with corrected memory errors ... (per Christoph Lameter's request). ... Updated for recent page flag clean-up. ... handler to the page migration code. ...
    (Linux-Kernel)
  • [PATCH 0/3] ia64: Migrate data off physical pages with correctable errors v5
    ... Migrate data off physical pages with corrected memory errors ... (per Linus Torvalds's request). ... Removed locking when calling the migration code ... If the page fails to migrate, clear the PG_memerror flag. ...
    (Linux-Kernel)
  • Re: IOCP touching my OVERLAPPED after my Write has completed
    ... Your code will leak memory in this case. ... WSASendTo() it seems a bit different. ... uncommitted by the completion routine. ... FreeRequest(req); //in debug I decommit the memory of this request ...
    (microsoft.public.win32.programmer.kernel)