Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19693 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69333 invoked by uid 1010); 22 Oct 2005 19:19:54 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 69318 invoked from network); 22 Oct 2005 19:19:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Oct 2005 19:19:54 -0000 X-Host-Fingerprint: 85.92.69.73 iko.gotobg.net Linux 2.4/2.6 Received: from ([85.92.69.73:53066] helo=iko.gotobg.net) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 05/3A-22302-9D09A534 for ; Sat, 22 Oct 2005 15:19:53 -0400 Received: from cpanel by iko.gotobg.net with local (Exim 4.52) id 1ETOuH-0007UN-Na; Sat, 22 Oct 2005 22:19:53 +0300 Received: from 83.97.27.123 ([83.97.27.123]) by hristov.com (Horde MIME library) with HTTP; Sat, 22 Oct 2005 21:19:53 +0200 Message-ID: <20051022211953.psli2nyiuy8soo00@hristov.com> Date: Sat, 22 Oct 2005 21:19:53 +0200 To: Andreas Korthaus Cc: internals@lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.0.3) Sender: X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - iko.gotobg.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [32001 32569] / [47 12] X-AntiAbuse: Sender Address Domain - hristov.com X-Source: /usr/local/cpanel/3rdparty/bin/php X-Source-Args: /usr/local/cpanel/3rdparty/bin/php /usr/local/cpanel/base/horde/imp/compose.php X-Source-Dir: :/base/horde/imp Subject: Re: [PHP-DEV] PHP 6.0 Wishlist [$_PERSISTENT] From: php@hristov.com (Andrey Hristov) Hi, DIY, it's not hard. You need a semaphore (*nix) and shared memory . Semaphores are not available on Windows but they are emulatable with ext/shmop. More info can be found here : http://hristov.com/andrey/projects/php_stuff/pres/writing_parallel_apps_with_PHP.pdf sources : http://hristov.com/andrey/projects/php_stuff/shm.php.gz Use class Shm_Protected_Var (works on *nix only but the sources are easibly patchable to work on windows with ext/shmop). Cheers, Andrey Andreas Korthaus wrote: > Jani Taskinen wrote: > > > >> On Sat, 22 Oct 2005, Sebastian Bergmann wrote: >> >>> Rasmus Lerdorf schrieb: >>> >>>> Include an opcode cache by default. A lot of work has gone into >>>> pecl/apc recently, but I am not hung up on which one goes in. >>> >>> >>> >>> In case we include APC by default, it would be nice if its apc_store() / >>> apc_fetch() mechanism could be mapped to a new super-global, say >>> $_PERSISTENT[]. >> >> >> >> Containing what? > > > > A super-global like $_PERSISTENT could work like $_SESSION, with a > similar "framework", but could store data which is NOT user-specific > like session-data. > > So you have a very simple methode to store any variables/objects between > HTTP-requests. If you use something like APC as backend, you will also > get a fast methode to store/load variables/objects, which are not > user-specific, and perhaps expensive to create/load (e.g. from a > webservice, DB...). > > The problem with "several machines serving same web pages" is exactly > the same you have with $_SESSION today. But the session extension > provides means to work around this using a DB or memcached as backend. > This could be copied by something like a "Persistance Framework". > > But many other PHP installations will have another problem you don't see > with $_SESSION today: concurrency. That's because you don't have a > unique session-ID anymore, so application1 can overwrite variables from > application2, script1.php can overwrite variables from script1.php and > on shared hosting setups user1 can overwrite variables from user2. > That's also a security issue. > > So an application-ID has been a good idea, but if you have to define it > by yourself, chances are that two users choose the same application-ID > and applications will break. So perhaps you also have to find some other > values, the users cannot control, to avoid concurrency issues. Perhaps > make a $_PERSISTENT variable only available for the script which has > created it (by saving the path too, but if you move/rename..., and not > very flexible anymore). > > > Best regards > Andreas > > > PS: I've read the discussion on this list before ;-) >