RE: [PHP] Re: The ASP "application" object in PHP?

2002-02-17 Thread Martin Towell

Isn't this something to do with shared memory? I haven't played with shared
memory before, but this sounds like it might work.

Martin

-Original Message-
From: Philip Hallstrom [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 16, 2002 8:37 AM
To: Peter J. Schoenster
Cc: [EMAIL PROTECTED]
Subject: [PHP] Re: The ASP "application" object in PHP?


Not that I'm an ASP expert, but I asked someone about this once and was
told that the application object is really just a session for that section
of the website.

In other words you configure IIS so that say "/foobar" is an application.
Then in /foobar/global.asa you do some stuff that sets up this application
object.  Now anyone who accesses /foobar has access to that object.  So
using this you could keep track of how many people are on the site ,etc...

While it's magic in ASP land, it is easily done with a bit of work in
PHP..

On Fri, 15 Feb 2002, Peter J. Schoenster wrote:

> On 15 Feb 2002, at 14:43, Bendik Simonsen wrote:
>
>
> > I have however, noticed one feature that ASP has that I have not found
> > an equal for in PHP: the "application" object.
> >
> > For those of you not familiar with ASP, the lowdown is this: The
> > application object acts like a global session. You assign it variables
> > and values like you would a session, but those variables are available
> > to all instances and sessions. It is for example very useful to track
> > different users at the same time, or to send messages from one session
> > to another, or the likes.
> >
> > Anything like this in PHP, or will I have to find a workaround for it,
> > or *ick* do that little sniplet in ASP?
>
> Well how does it work? Is it advertised as M$ magic in the class?
> Is http not stateless?
>
> I don't follow your description and I don't believe in magic.
>
> Is it using cookies? If not what? It must be using something?
>
> I bet it's using cookies. Sounds a lot like what you normally do with
> sessions. I don't follow the "send message from one session to
> another" ... is this not just normal course for sessions?  I'd like
> more explanation before I believe that this is any more than just a
> module.
>
> Peter
> http://www.readbrazil.com/
> Answering Your Questions About Brazil
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: The ASP "application" object in PHP?

2002-02-15 Thread Michael Sims

At 02:21 PM 2/15/2002 -0500, Michael Kimsal wrote:
>I've been here all along!  :)
>
>Seriously, we cover some of this in our class as well, and at our monthly 
>PHP user group meetings.  I'm actually writing up a small paper
>on this and other topics.  If you're interested in it, let me know.
>
>I can also be reached at 734-480-9961 if you've questions that might
>be faster talking about than emailing, and my AIM is 'mgkimsal' is you're 
>on that and need some help.
>
>That goes for anyone else on the list too...

OMG you may end up regretting that.  I'm putting you on my speed dial right 
now... :-P  Yeah, it's not toll-free but as They say "it's free if you call 
from work"


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: The ASP "application" object in PHP?

2002-02-15 Thread Philip Hallstrom

Not that I'm an ASP expert, but I asked someone about this once and was
told that the application object is really just a session for that section
of the website.

In other words you configure IIS so that say "/foobar" is an application.
Then in /foobar/global.asa you do some stuff that sets up this application
object.  Now anyone who accesses /foobar has access to that object.  So
using this you could keep track of how many people are on the site ,etc...

While it's magic in ASP land, it is easily done with a bit of work in
PHP..

On Fri, 15 Feb 2002, Peter J. Schoenster wrote:

> On 15 Feb 2002, at 14:43, Bendik Simonsen wrote:
>
>
> > I have however, noticed one feature that ASP has that I have not found
> > an equal for in PHP: the "application" object.
> >
> > For those of you not familiar with ASP, the lowdown is this: The
> > application object acts like a global session. You assign it variables
> > and values like you would a session, but those variables are available
> > to all instances and sessions. It is for example very useful to track
> > different users at the same time, or to send messages from one session
> > to another, or the likes.
> >
> > Anything like this in PHP, or will I have to find a workaround for it,
> > or *ick* do that little sniplet in ASP?
>
> Well how does it work? Is it advertised as M$ magic in the class?
> Is http not stateless?
>
> I don't follow your description and I don't believe in magic.
>
> Is it using cookies? If not what? It must be using something?
>
> I bet it's using cookies. Sounds a lot like what you normally do with
> sessions. I don't follow the "send message from one session to
> another" ... is this not just normal course for sessions?  I'd like
> more explanation before I believe that this is any more than just a
> module.
>
> Peter
> http://www.readbrazil.com/
> Answering Your Questions About Brazil
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: The ASP "application" object in PHP?

2002-02-15 Thread Michael Kimsal

Erik Price wrote:
> 
> On Friday, February 15, 2002, at 10:42  AM, Michael Kimsal wrote:
> 
>> Remember, ASP is not a language, and PHP is.  You're not programming 
>> "ASP" - you are most likely programming VBScript and your server 
>> environment gives that language access to server-specific functions
>> such as an application object.
> 
> 
> Where were you yesterday when I needed this kind of explanation!  :)
> 
> To explain the nature of my site and why I chose the route that I did, I 
> used a brief explanation of how the client-server-PHP system works.  
> But, with no experience with any other scripting language, I didn't have 
> much to justify why I chose PHP (the real reason is a matter of ethics ;).
> 
> I would love to have had your explanation of ASP's application object vs 
> PHP's lack of an "application object" when I wrote that.  I'm saving 
> this post.


I've been here all along!  :)

Seriously, we cover some of this in our class as well, and at our 
monthly PHP user group meetings.  I'm actually writing up a small paper
on this and other topics.  If you're interested in it, let me know.

I can also be reached at 734-480-9961 if you've questions that might
be faster talking about than emailing, and my AIM is 'mgkimsal' is 
you're on that and need some help.

That goes for anyone else on the list too...



Michael Kimsal
http://www.tapinternet.com/php
PHP Training Courses
734-480-9961




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: The ASP "application" object in PHP?

2002-02-15 Thread Erik Price


On Friday, February 15, 2002, at 10:42  AM, Michael Kimsal wrote:

> Remember, ASP is not a language, and PHP is.  You're not programming 
> "ASP" - you are most likely programming VBScript and your server 
> environment gives that language access to server-specific functions
> such as an application object.

Where were you yesterday when I needed this kind of explanation!  :)

To explain the nature of my site and why I chose the route that I did, I 
used a brief explanation of how the client-server-PHP system works.  
But, with no experience with any other scripting language, I didn't have 
much to justify why I chose PHP (the real reason is a matter of 
ethics ;).

I would love to have had your explanation of ASP's application object vs 
PHP's lack of an "application object" when I wrote that.  I'm saving 
this post.



Erik





Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: The ASP "application" object in PHP?

2002-02-15 Thread Michael Kimsal

Bendik Simonsen wrote:
> I've recently started to learn ASP (*ducks the hurled flowerpots and
> vases*) because my school requires it, but of course I prefer PHP for
> my own scripting needs.
> 
> I have however, noticed one feature that ASP has that I have not found
> an equal for in PHP: the "application" object.
> 
> For those of you not familiar with ASP, the lowdown is this: The
> application object acts like a global session. You assign it variables
> and values like you would a session, but those variables are available
> to all instances and sessions. It is for example very useful to track
> different users at the same time, or to send messages from one session
> to another, or the likes.
> 
> Anything like this in PHP, or will I have to find a workaround for it,
> or *ick* do that little sniplet in ASP?
> 
> Thanks,
> Bendik Simonsen
> 


It doesn't exist.  ASP is an application framework which exposes and 
manages those types of objects.  It could easily be approximated simply
by storing things in a database.

There are significant drawbacks to earlier versions of ASP's handling
of application variables - I can not vouch for these issues with Windows 
2000 and above.  However:

1.  Application variables didn't scale across machines.  Just like
session variables, application variables were/are tied to one machine. 
In load balanced environments, this is useless.

2.  Resource management.  Application variables were tied to a specific 
thread, so even in your multithreaded
IIS environment, accessing/updating app variables would require a 
specific thread to be open/available.  If 10 threads needed to update 
the application variable, they'd all have to wait sequenatially.

3.  Easy to abuse.  So many people abused the heck out of them it gave
ASP a bad name in speed with average users.  MS went so far as to say
in some of their white papers not to use application variables if
speed was a concern.  Also, many people would put database connection 
objects inside application variables, which was just hilarious, because
of the single-thread issue above.

There are a few other issues with application variables which rub me the 
wrong way - at least the early MS implementations - again, I can't speak 
to modern variations, but I suspect many of the same issues exist to
some degree or another.  They seem much like a 'crutch' if you will - if
you need global variables, build an 'appobject' table and put variables 
in there, and simply create some functions to manage it.  Maybe even 
create an 'application object' of your own, and instantiate it at the
start of every PHP request.  It would be a farily trivial thing, except 
for 'restarting' the application object when the application was 
'restarted' (stop/start IIS, among other things).

Remember, ASP is not a language, and PHP is.  You're not programming 
"ASP" - you are most likely programming VBScript and your server 
environment gives that language access to server-specific functions
such as an application object.

Remember the distinction, and it should be easy to see how to duplicate 
that type of functionality within the context of the PHP language.

Hope that helps.

P.S.  This is the kind of stuf we go over in depth in our PHP training 
courses for people migrating from ASP and/or operating in dual-language
mode.  :)


--
Michael Kimsal
http://www.tapinternet.com/php
PHP Training Courses
734-480-9961



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php