Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Application Scope variables ?
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? 


Report this thread to moderator Post Follow-up to this message
Old Post
aa
09-20-04 02:00 PM


Re: Application Scope variables ?
aa 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.

Report this thread to moderator Post Follow-up to this message
Old Post
Ruben van Engelenburg
09-20-04 02:00 PM


Re: Application Scope variables ?
"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



Report this thread to moderator Post Follow-up to this message
Old Post
Virgil Green
09-20-04 08:57 PM


Re: Application Scope variables ?
Dear 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

Report this thread to moderator Post Follow-up to this message
Old Post
Lucas
09-21-04 01:58 AM


Re: Application Scope variables ?
> 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.

Report this thread to moderator Post Follow-up to this message
Old Post
Zurab Davitiani
09-21-04 01:58 AM


Re: Application Scope variables ?
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.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.

Report this thread to moderator Post Follow-up to this message
Old Post
Lucas
09-21-04 01:56 PM


Re: Application Scope variables ?
"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



Report this thread to moderator Post Follow-up to this message
Old Post
Virgil Green
09-21-04 01:56 PM


Re: Application Scope variables ?
Session 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 
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
aa
09-21-04 08:56 PM


Re: Application Scope variables ?
"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 



Report this thread to moderator Post Follow-up to this message
Old Post
aa
09-21-04 08:56 PM


Re: Application Scope variables ?
Just 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? 


Report this thread to moderator Post Follow-up to this message
Old Post
aa
09-21-04 08:56 PM


Sponsored Links




Last Thread Next Thread Next
Pages (3): [1] 2 3 »
Search this forum -> 
Post New Thread

PHP Language archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:16 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.