Code Comments
Programming Forum and web based access to our favorite programming groups.I am migrating to PHP from ASP where there are the Application Scope variabl es which are accessible from any page on a website and which are used, in pa rticular, for hit counters. Is there a similar mechanism in PHP?
Post Follow-up to this messageaa wrote: > I am migrating to PHP from ASP where there are the Application Scope > variables which are accessible from any page on a website and which are > used, in particular, for hit counters. > Is there a similar mechanism in PHP? Hi, Yes there is, take a look at sessions: http://nl3.php.net/manual/en/ref.session.php Regards, Ruben.
Post Follow-up to this message"Ruben van Engelenburg" <ruben@NOSPAM!.nl> wrote in message news:414ebb56$0$65124$e4fe514c@news.xs4all.nl... > aa wrote: > > Hi, > > Yes there is, take a look at sessions: > http://nl3.php.net/manual/en/ref.session.php Sessions are not the same as application scope, I don't believe. I've seen references to shared memory schemes, but they are avaialble to the entire computer, not just a single application (all sessions running under the same site id, for example). - Virgil
Post Follow-up to this messageDear Virgil, your thinking is still too influenced by the rigid ASP structure. Relax, open your mind and RTFM on sessions. :-) Best Regards, Lucas "Virgil Green" <vjg@DESPAMobsydian.com> wrote in message news:<CnE3d.12658$yp2.5590@newssvr 30.news.prodigy.com>... > "Ruben van Engelenburg" <ruben@NOSPAM!.nl> wrote in message > news:414ebb56$0$65124$e4fe514c@news.xs4all.nl... > > Sessions are not the same as application scope, I don't believe. > > I've seen references to shared memory schemes, but they are avaialble to t he > entire computer, not just a single application (all sessions running under > the same site id, for example). > > - Virgil
Post Follow-up to this message> your thinking is still too influenced by the rigid ASP structure. > Relax, open your mind and RTFM on sessions. :-) Session variables are not the same as application-level variables. ASP offers an application framework, ASP *is* the framework. Having said that, you can replicate functionality via PHP by either using common files for variable storage/retrieval, or using a database. Some info should be easily locatable by searching.
Post Follow-up to this messageDear Zurab, sessions are stored as common files on the web server, one can configure it accordingly to his/her needs so that data(variables) are accesible from the required scope. Is there anything I missed? Best Regards, Lucas Zurab Davitiani <agt@mindless.com> wrote in message news:<ALJ3d.21759$Lf5.2677@newssvr27.ne ws.prodigy.com>... > > Session variables are not the same as application-level variables. ASP > offers an application framework, ASP *is* the framework. > > Having said that, you can replicate functionality via PHP by either using > common files for variable storage/retrieval, or using a database. Some inf o > should be easily locatable by searching.
Post Follow-up to this message"Lucas" <thelucas@directbox.com> wrote in message news:fdb66b30.0409201432.a250159@posting.google.com... > Dear Virgil, > > your thinking is still too influenced by the rigid ASP structure. > Relax, open your mind and RTFM on sessions. :-) I'm hardly influenced by ASP structure. I've never worked in ASP. I've read the PHP manual sections on sessions many times before. Please, enlighten me. Explain to me how sessions could be used to provide the equivalent of application-scoped variables in ASP. The closest thing I see is by sharing session IDs. That, of course, is a hack. There would be nothing by default to synchronize access between multiple requests, so each request could start with the same session info, update it and then spend time merrily writing over each others changes. I could write my own custom save handler, but I believe that writing such a handler to manage multiple sessions as a single "session" would violate the spirit of the session and lead to a maintenance nightmare. I look forward to the details of your strategy. - Virgil
Post Follow-up to this messageSession will only make such a variable available within this session. But I am talking about a variable available from any page from any session "Tony Marston" <tony@NOSPAM.demon.co.uk> wrote in message news:cip0pa$ig4$1$8300dec7@news.demon.co.uk... > > "aa" <aa@virgin.net> wrote in message > news:415002f7$0$42212$ed2e19e4@ptn-nntp-reader04.plus.net... retrieve > > If you want to store variables between one page and another the PHP way is > sessions. All you need is session_start() at the beginning of each script. > This will create an empty $_SESSION array the first time, then give you back > everything you put in it. > > Note that you do not have to write the session data out to file manually as > PHP will do it automatically for you at the end of the script. It's all in > the manual. > > -- > Tony Marston > > http://www.tonymarston.net > > > using > >
Post Follow-up to this message"sessions are stored as common files on the web server" Lucas, 1. Do these "common files" keep sitting on the disk after the relevant session expired? 2. If they do, then for how long? 3. And how they might be accessed from another session? Even if they can be accessable, I have difficulties to see a practical use of them unless you keep track of every session file which is a tedious task "Lucas" <thelucas@directbox.com> wrote in message news:fdb66b30.0409202352.6263ac6f@posting.google.com... > Dear Zurab, > > sessions are stored as common files on the web server, one can > configure it accordingly to his/her needs so that data(variables) are > accesible from the required scope. Is there anything I missed? > > > Best Regards, > > Lucas > > > Zurab Davitiani <agt@mindless.com> wrote in message news:<ALJ3d.21759$Lf5.2677@newssvr27.news.prodigy.com>... using info
Post Follow-up to this messageJust to stream the discussion up - how a page hit conter in implemented in P HP? In ASP you increment a relative Application scope variable every time a page is requested. This veraible is accessible from any session. This variable is sitting in the memory as long as the Application (i.e. the website) is running. If the Application is stopped, it fires an event "application_on_close" and on this event you write an application data to a file from which it can be r ecovered when the application is restarted. How do I get the same effect in PHP? "aa" <aa@virgin.net> wrote in message news:414eb86a$0$80627$ed2619ec@ptn-nnt p-reader01.plus.net... I am migrating to PHP from ASP where there are the Application Scope variabl es which are accessible from any page on a website and which are used, in pa rticular, for hit counters. Is there a similar mechanism in PHP?
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.