From: matt d. <mm_...@ya...> - 2008-03-14 23:16:27
|
Yeah- I would use AJAX to talk/poll server and JSON as a fast transport of state objects and either sessions or a db to store the state on the server. Sessions have an expiration you'll need to account for but otherwise you'll need some authentication for a db state. Using JSON to store all the state/object data between server and client would keep it pretty simple without a lot of translation. I usually code all my client UI's to just handle JSON, which keeps your code very clean. Translating a JSON object array to a sortable table for example is very fast and efficient and can be used over and over. Matt ----- Original Message ---- From: Jason Rexilius <ja...@ho...> To: Discussions of PHP-related topics among members of the Chicago PHP User's Group. <chi...@li...> Sent: Friday, March 14, 2008 5:01:25 PM Subject: Re: [chiPHPug-discuss] hi, PHP gurus in Chicago land 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 ------------------------------------------------------------------------- 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 |