Hey Joe!
In short PHP in standard config (mod_php in apache) doesn't keep
itself alive but rather lives inside the Apache children daemons.
But whenever it gets called to execute code it starts with a clean
interpreter, meaning state gets dropped between request processing.
This is a Good Thing when it comes to pure HTTP-based web
applications and makes for cleaner horizontal scaling.
It is however a downside when you try to do things like what you are
describing. Java is generally better suited to bolting HTTP on top of
client-server model applications. If you want it to stay on a single
machine that is.
The way you might approach this would be to use traditional Unix
models for IPC and network programming. Fork a background process to
maintain persistent connection to server (if thats required) and pick an
IPC mechanism for subsequent HTTP transactions to request state and
eventually flush output to client. You could use a simple
Javascript/AJAX mechanism to poll (web) server every so often.
The great thing about PHP is it doesn't hide the OS from you, so if
you know how to use the Unix operating system for distributed or network
computing, then PHP plays very nice with it. If you only know a
programming language (like Java) then you would have a hard time doing
everything in pure PHP.
Hope that helps some!
-jason
Guangsheng HE wrote:
> Hi to all PHP gurus in Chicago land!
>
> I have been working with C/C++/Perl in UNIX/LINUX environment for many years
> and now want to create web for both myself and some projects at work.
>
> I have experience with simple HTML, CGI and SQL, and a little bit PHP work
> two years ago. I want to use PHP to make my user interface nice and friendly
> -:)
>
> I want this page talk to communicate with server and display contents.
> Because users are not superuser so I run several listening process/thread on
> server side, I wish this php page can constantly exchanges data with server.
> Some process might take more than 10 minutes before sending feedback to
> client.
>
> First 'dump' question is, how PHP keeps alive and refresh itself?
>
> Happy weekend to you all.
>
> Joe
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> chiPHPug-discuss mailing list
> chi...@li...
> https://lists.sourceforge.net/lists/listinfo/chiphpug-discuss
|